Skip to content

Stability fixes for o2-sim - #15842

Closed
sawenzel wants to merge 7 commits into
AliceO2Group:devfrom
sawenzel:swenzel/o2sim-bugfixes
Closed

sawenzel wants to merge 7 commits into
AliceO2Group:devfrom
sawenzel:swenzel/o2sim-bugfixes

Conversation

@sawenzel

Copy link
Copy Markdown
Collaborator

A few stability fixes for o2-sim found by general review of Claude code.

sawenzel and others added 7 commits September 24, 2026 20:52
This fixes a problem in how the o2-sim driver judges the hit merger's exit code.

- The condition `!= 0 || != 128` is always true, so every normal merger exit was reported as an error.
- It now reads `!= 0 && != 128`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This fixes the generator cache of the o2-sim primary server so that it skips external kinematics, as its comment intends.

- The condition `!= "extkin" || != "extkinO2"` is always true, so extkin generators were cached too.
- A service-mode reconfiguration with a new kinematics file then reused the old generator and file.
- The condition now uses `&&`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This fixes the info thread of the o2-sim primary server for requests of unexpected size.

- After the error reply the thread still read the request and could send a second reply on the REP socket.
- It now continues to the next request after the error reply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This fixes how the hit merger advances to the next event while flushing.

- The skip paths advanced the event counter but then carried on with the current event.
- With --noemptyevents, an event without hits was written when the next event was already complete, and that next event was then skipped.
- An event without buffered info dereferenced the end iterator.
- The loop now iterates over flushable event IDs and every skip path is a plain continue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This fixes a memory leak in the hit merger and makes its merge flag thread-safe.

- cleanEvent was empty, so the decoded SubEventInfo objects of every event were never freed.
- The MC tracks and track references of events dropped by --noemptyevents were never freed either.
- cleanEvent now owns the release of all three buffers; the merge functions no longer delete.
- Buffer entries are emptied rather than erased, since erasing from a tbb::concurrent_unordered_map is not safe while the receiving thread inserts.
- handleSimData keeps the event id and event count as values, since a merge thread may free the event info.
- mergingInProgress is shared by two threads and is now std::atomic<bool>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This fixes the hit merger when it runs without disc output.

- The kinematics and MC-header file and tree pointers were never initialised.
- With --noDiscOutput they stayed garbage, and the merge tested them as if they were valid trees.
- They are now initialised to nullptr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This fixes the order in which a parallel o2-sim worker finalizes and sends the hits of an event.

- Detectors ran FinishEvent after SendData, while serial o2-sim (FairMCApplication) runs it before filling the output.
- TRD sorts its hits in FinishEvent, and PHOS and CPV sort them and sum duplicates.
- With TMessage transport their hits were written unsorted and, for PHOS and CPV, with duplicates.
- With shared memory the merger read the buffers while the worker rewrote them, so TRD output differed between the two transports.
- FinishEvent now runs for all detectors before SendData, and EndOfEvent after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawenzel
sawenzel requested review from a team and shahor02 as code owners September 25, 2026 06:26
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for 43df410 at 2026-09-25 08:45:

No log files found

Full log here.

@sawenzel sawenzel closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants