Skip to content

Set the static TLS reserve for Geant4 inside the sim executables - #16105

Merged
sawenzel merged 1 commit into
AliceO2Group:devfrom
sawenzel:swenzel/static-tls-reexec
Nov 11, 2026
Merged

sawenzel merged 1 commit into
AliceO2Group:devfrom
sawenzel:swenzel/static-tls-reexec

Conversation

@sawenzel

@sawenzel sawenzel commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

This is fixing a bug where o2-sim cannot load Geant4 on the GRID since today's daily ("cannot allocate memory in static TLS block").

Geant4 is now built with the initial-exec TLS model and loaded by dlopen, so glibc needs a static TLS reserve, which the Geant4 environment sets in GLIBC_TUNABLES. In GRID jobs this variable arrives truncated as glibc.rtld.optional_static_tls, without its value, and glibc ignores it.

o2-sim now sets the reserve at start, so the workers it launches have it. The executables that load Geant4 also check it first in main and, if it is missing or too small, restart themselves once with it set, since glibc reads tunables only at program start.

https://its.cern.ch/jira/browse/O2-7305

Assisted by Claude Code.

@sawenzel
sawenzel requested a review from a team as a code owner November 11, 2026 11:56
@sawenzel
sawenzel force-pushed the swenzel/static-tls-reexec branch from 35d6199 to 711a69e Compare November 11, 2026 12:11
This fixes o2-sim on the GRID, where Geant4 cannot be loaded since it uses the initial-exec TLS model, and adds a unit test.

- A Geant4 loaded by dlopen needs a glibc static TLS reserve, which the Geant4 environment sets in GLIBC_TUNABLES.
- In GRID jobs the variable arrives truncated as glibc.rtld.optional_static_tls, without its value, and is ignored.
- o2-sim now sets the reserve at start, so the workers it launches have it.
- The executables that load Geant4 check the reserve first in main and, if it is missing or too small, restart
  themselves once with it set, since glibc reads tunables only at program start.
- Other tunables are kept, and a larger reserve set by the user is left as is.

https://its.cern.ch/jira/browse/O2-7305

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawenzel
sawenzel force-pushed the swenzel/static-tls-reexec branch from 3ad18c8 to c5ac3b1 Compare November 11, 2026 12:16
@sawenzel
sawenzel merged commit f9c9589 into AliceO2Group:dev Nov 11, 2026
10 of 11 checks passed
@sawenzel
sawenzel deleted the swenzel/static-tls-reexec branch November 12, 2026 12:36
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.

1 participant