mining.genetic: a genetic run cancels the runs of other users and tabs #3

Open
opened 2026-10-06 13:44:32 +00:00 by ffrauenberger · 0 comments
Owner

Severity: critical (on the hosted service, one user's run silently cancels another user's run)

Where

  • app/mining_algorithms/genetic_mining.py:28-29, :110-113, :160-166, :342-350

Problem

GeneticMining cancels running evolutions through class-level state:

_global_current_run_id = None
_global_lock = threading.Lock()

Every call to generate_graph overwrites GeneticMining._global_current_run_id with a new UUID. Each running evolution loop checks once per generation whether the global ID still matches its own and stops if not. After the loop, generate_graph also returns without building a graph if the IDs differ.

Streamlit serves all browser sessions from the same Python process, so this "global" ID is shared by all users and all tabs.

Steps to reproduce

  1. In tab A, import a log, select the Genetic Miner and click Run Genetic Mining
  2. While it is running, start a genetic run in tab B (same or different user)
  3. Look at tab A once the run there ends

Expected behavior

Both runs complete independently and each tab shows its own model.

Actual behavior

The run in tab A stops at the next generation boundary and self.graph is not updated (None on the first run, otherwise the previous graph). Tab A shows no error, only the info box "Please adjust the Genetic Mining settings…" or a stale model that does not match the parameters. Because rerun_genetic_miner is reset, user A has to click Run again, which in turn cancels B's run.

Related: #54.

Fix

Make cancellation per session: keep the run ID / cancellation token on the model instance (or in st.session_state) and check self._current_run_id instead of the class attribute. Longer term, run long computations in a managed worker with explicit cancellation (#54).


from issues/BUG-003-genetic-miner-global-run-id-cancels-other-users.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** critical (on the hosted service, one user's run silently cancels another user's run) ## Where - `app/mining_algorithms/genetic_mining.py:28-29`, `:110-113`, `:160-166`, `:342-350` ## Problem `GeneticMining` cancels running evolutions through class-level state: ```python _global_current_run_id = None _global_lock = threading.Lock() ``` Every call to `generate_graph` overwrites `GeneticMining._global_current_run_id` with a new UUID. Each running evolution loop checks once per generation whether the global ID still matches its own and stops if not. After the loop, `generate_graph` also returns without building a graph if the IDs differ. Streamlit serves all browser sessions from the same Python process, so this "global" ID is shared by all users and all tabs. ### Steps to reproduce 1. In tab A, import a log, select the Genetic Miner and click *Run Genetic Mining* 2. While it is running, start a genetic run in tab B (same or different user) 3. Look at tab A once the run there ends ### Expected behavior Both runs complete independently and each tab shows its own model. ### Actual behavior The run in tab A stops at the next generation boundary and `self.graph` is not updated (`None` on the first run, otherwise the previous graph). Tab A shows no error, only the info box *"Please adjust the Genetic Mining settings…"* or a stale model that does not match the parameters. Because `rerun_genetic_miner` is reset, user A has to click *Run* again, which in turn cancels B's run. Related: #54. ## Fix Make cancellation per session: keep the run ID / cancellation token on the model instance (or in `st.session_state`) and check `self._current_run_id` instead of the class attribute. Longer term, run long computations in a managed worker with explicit cancellation (#54). --- from `issues/BUG-003-genetic-miner-global-run-id-cancels-other-users.md` (code analysis of commit 6bcc646, 2026-10-03)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#3
No description provided.