Skip to content

Only stash worker run data when a run streamer will drain it#154

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/126-worker-stash-gate
Jun 13, 2026
Merged

Only stash worker run data when a run streamer will drain it#154
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/126-worker-stash-gate

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

Workers called stash_worker_run_data() at the end of every run, but the master drains the static pool (take_completed_worker_run_data) only when need_a_run_streamer is true. With no run-mode digitizer, the pool was never cleared and grew run after run; a later run that did enable a run streamer then merged in all the stale prior-run contributions — double-counting events_processed (the normalization denominator) and run-summary counters — and leaked memory in the common no-run-streamer case.

Gate the worker stash on need_a_run_streamer, the same condition the master uses to drain. Workers and master compute it identically in BeginOfRunAction, so the pool is filled iff it will be drained that run.

Validation: gRunAction.cc compiles clean (Geant4 11.4.1 dev container).

Fixes #126

Workers called stash_worker_run_data() at the end of every run, but the
master drains the static pool (take_completed_worker_run_data) only when
need_a_run_streamer is true. With no run-mode digitizer, the pool was
never cleared and grew run after run; a later run that did enable a run
streamer then merged in all the stale prior-run contributions,
double-counting events_processed (the normalization denominator) and run
summary counters, and leaking memory in the common no-run-streamer case.

Gate the worker stash on need_a_run_streamer, the same condition the
master uses to drain. Workers and master compute it identically in
BeginOfRunAction, so the pool is filled iff it will be drained that run.

Fixes gemc#126

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maureeungaro maureeungaro merged commit e7619b6 into gemc:main Jun 13, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Medium] Worker run-data stashed every run but drained only when run streamers exist

2 participants