Skip to content

Key the streamer map by output name so same-format outputs don't collide#153

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/106-streamer-key-collision
Jun 13, 2026
Merged

Key the streamer map by output name so same-format outputs don't collide#153
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/106-streamer-key-collision

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

gstreamersMapPtr keyed the per-thread streamer map by the format-derived plugin name ("gstreamer_<format>_plugin"), so two outputs of the same format (e.g. two csv files with different filenames) mapped to the same key: the second emplace was a no-op and the following .at()->define_gstreamer() rebound the first instance to the second definition — silently dropping one output.

Key the map by the unique per-output rootname instead. The plugin library is still loaded by the format-derived name, and each LoadAndRegisterObjectFromLibrary call returns a fresh GStreamer instance (only the dlopen handle is cached), so same-format outputs stay independent. Duplicate output names are skipped with a warning. The map key is only used as a log label at all iteration sites, so the rename is safe.

Validation: ran the gstreamer CSV example with two csv outputs in the Geant4 11.4.1 dev container. Before: only the second output's 16 files were written (the first was lost). After: both output file sets (16 + 16) are produced.

Fixes #106

gstreamersMapPtr keyed the per-thread streamer map by the format-derived
plugin name ("gstreamer_<format>_plugin"), so two outputs of the same
format (e.g. two csv files with different filenames) mapped to the same
key: the second emplace was a no-op and the following .at()->
define_gstreamer() rebound the first instance to the second definition,
silently dropping one output.

Key the map by the unique per-output rootname instead (the plugin
library is still loaded by the format-derived name, and each load returns
a fresh GStreamer instance, so same-format outputs stay independent).
Duplicate output names are skipped with a warning. The map key is only
used as a log label at all iteration sites, so the rename is safe.

Validated by running the gstreamer CSV example with two csv outputs:
before, only the second output's files were written; after, both
output file sets are produced (Geant4 11.4.1 dev container).

Fixes gemc#106

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maureeungaro maureeungaro merged commit c52ea41 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.

[High] Multiple same-format gstreamer outputs collapse into a single streamer

2 participants