Geant4 Version: 10.07.p04 and 11.4.1
Operating System: MacOS Tahoe 26.5 vs. RHEL8
Compiler/Version: Apple Clang 12.0.0 vs.
CMake Version: 4.2.3
I have run into a strange and very irritating problem with the Digitizer code in our CDMS detector response simulation. I am confident it is not a Geant4 issue, but I’m hoping one of the G4 MT experts could give me some guidance offline.
I have a file-scoped global function, in which I call G4AutoLock(&rootMutex) (where the latter is a file-scoped G4Mutex objedct, as usual). As near as I can tell, this mutex is being ignored under RHEL8/GCC-12.2.0, and I am getting data race errors (via the -fsanitize=thread compiler flag) from all four threads doing the things in the the function after the mutex-lock.
The underlying evil is ROOT. This particular function instantiates a TF1 wrapper function, so that we can do a zero-finding at the start the Digitizer stage. ROOT apparently tries to register every newly created object in some global registry, and does so in an entirely thread-unsafe way ![]()
What’s confusing me, and what I’d appreciate some offline help with, is why the mutex is respected on my Mac, but seems to be ignored on RHEL8. It’s the same source code in both cases (same feature branch of our simulation repository), the same job configuration, even the same random seeds.