# Segmentation violation - Geant4 MT Build + FairRunSim

**URL:** <https://root-forum.cern.ch/t/segmentation-violation-geant4-mt-build-fairrunsim/42376>\
**Category:** Newbie\
**Created:** [November 20, 2020, 6:26am UTC](https://root-forum.cern.ch/t/segmentation-violation-geant4-mt-build-fairrunsim/42376 "2020-11-20T06:26:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aleksey](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/bc8723/32.png) [@aleksey](https://root-forum.cern.ch/u/aleksey)\
**Post date:** [November 20, 2020, 6:26am UTC](https://root-forum.cern.ch/t/segmentation-violation-geant4-mt-build-fairrunsim/42376/1 "2020-11-20T06:26:33Z")

</div>

* * *

Hi, everyone. I have some segmentation violation when i use FairRunSim and Geant4 MT build. I have segmentation violation in both modes - MT and not.  
Could anyone prompt place of problem based on stack trace? Thank you.

_===========================================================_  
_There was a crash._  
_This is the entire stack trace of all threads:_  
_===========================================================_

_Thread 3 (Thread 0x7f6695e09700 (LWP 4162) “root.exe”):_  
_#0 0x00007f66b2c29167 in \_\_GI\_\_\_wait4 (pid=4166, stat\_loc=stat\_loc_  
_entry=0x7f6695e01028, options=options_  
_entry=0, usage=usage_  
_entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:27_  
_#1 0x00007f66b2c290e7 in \_\_GI\_\_\_waitpid (pid=, stat\_loc=stat\_loc_  
_entry=0x7f6695e01028, options=options_  
_entry=0) at waitpid.c:38_  
_#2 0x00007f66b2ba6a07 in do\_system (line=) at …/sysdeps/posix/system.c:172_  
_#3 0x00007f66b32584bc in TUnixSystem::StackTrace() () from /opt/fairsoft/install/lib/root/libCore.so.6.16_  
_#4 0x00007f66b325593c in TUnixSystem::DispatchSignals(ESignals) () from /opt/fairsoft/install/lib/root/libCore.so.6.16_  
_#5_  
_#6 0x00007f66a72b535d in TGeoVolumeAssembly::SetNextNodeIndex(int) () from /opt/fairsoft/install/lib/root/libGeom.so.6.16_  
_#7 0x00007f66a728500f in TGeoShapeAssembly::DistFromOutside(double const_, double const\*, int, double, double\*) const [clone .part.0] () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#8 0x00007f66a7285173 in TGeoShapeAssembly::DistFromOutside(double const_, double const\*, int, double, double\*) const [clone .part.0] () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#9 0x00007f66a72528f7 in TGeoNavigator::FindNextDaughterBoundary(double_, double\*, int&, bool) () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#10 0x00007f66a7256973 in TGeoNavigator::FindNextBoundary(double, char const_, bool) () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#11 0x00007f669e177b44 in TG4RootNavigator::ComputeStep(CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const&, double, double&) () from /opt/fairsoft/install/lib/libg4root.so_  
_#12 0x00007f669d0e159e in G4PropagatorInField::ComputeStep(G4FieldTrack&, double, double&, G4VPhysicalVolume_) () from /opt/fairsoft/install/lib/libG4geometry.so\*  
_#13 0x00007f6697828bd2 in G4Transportation::AlongStepGetPhysicalInteractionLength(G4Track const&, double, double, double&, G4GPILSelection_) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#14 0x00007f669d95c91d in G4SteppingManager::DefinePhysicalStepLength() () from /opt/fairsoft/install/lib/libG4tracking.so_  
_#15 0x00007f669d95acc0 in G4SteppingManager::Stepping() () from /opt/fairsoft/install/lib/libG4tracking.so_  
_#16 0x00007f669d9663ff in G4TrackingManager::ProcessOneTrack(G4Track_) () from /opt/fairsoft/install/lib/libG4tracking.so\*  
_#17 0x00007f669d9a3cd2 in G4EventManager::DoProcessing(G4Event_) () from /opt/fairsoft/install/lib/libG4event.so\*  
_#18 0x00007f669da4fc14 in G4WorkerRunManager::DoEventLoop(int, char const_, int) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#19 0x00007f669da43c5e in G4RunManager::BeamOn(int, char const_, int) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#20 0x00007f669da513a4 in G4WorkerRunManager::DoWork() () from /opt/fairsoft/install/lib/libG4run.so_  
_#21 0x00007f669da5aaa1 in G4MTRunManagerKernel::StartThread(G4WorkerThread_) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#22 0x00007f66b2e0bed0 in ?? () from /usr/lib/x86\_64-linux-gnu/libstdc++.so.6_  
_#23 0x00007f66b2a83ea7 in start\_thread (arg=) at pthread\_create.c:477_  
_#24 0x00007f66b2c5bd4f in clone () at …/sysdeps/unix/sysv/linux/x86\_64/clone.S:95_

_Thread 2 (Thread 0x7f669660a700 (LWP 4161) “root.exe”):_  
_#0 0x00007f66971a3fc3 in G4PiData::ReactionXSection(double) () from /opt/fairsoft/install/lib/libG4processes.so_  
_#1 0x00007f669716e4d2 in G4ComponentBarNucleonNucleusXsc::ComputeCrossSections(G4ParticleDefinition const_, double, int) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#2 0x00007f669719fb2d in G4NucleonNuclearCrossSection::ComputeCrossSections(G4ParticleDefinition const_, double, int) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#3 0x00007f669719fb72 in G4NucleonNuclearCrossSection::GetElementCrossSection(G4DynamicParticle const_, int, G4Material const\*) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#4 0x00007f669712253f in G4BGGNucleonInelasticXS::GetElementCrossSection(G4DynamicParticle const_, int, G4Material const\*) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#5 0x00007f669717768b in G4CrossSectionDataStore::GetCrossSection(G4DynamicParticle const_, G4Element const\*, G4Material const\*) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#6 0x00007f6697178869 in G4CrossSectionDataStore::ComputeCrossSection(G4DynamicParticle const_, G4Material const\*) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#7 0x00007f66971b8545 in G4HadronicProcess::GetMeanFreePath(G4Track const&, double, G4ForceCondition_) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#8 0x00007f66977ef74c in G4VDiscreteProcess::PostStepGetPhysicalInteractionLength(G4Track const&, double, G4ForceCondition_) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#9 0x00007f669d95c7d0 in G4SteppingManager::DefinePhysicalStepLength() () from /opt/fairsoft/install/lib/libG4tracking.so_  
_#10 0x00007f669d95acc0 in G4SteppingManager::Stepping() () from /opt/fairsoft/install/lib/libG4tracking.so_  
_#11 0x00007f669d9663ff in G4TrackingManager::ProcessOneTrack(G4Track_) () from /opt/fairsoft/install/lib/libG4tracking.so\*  
_#12 0x00007f669d9a3cd2 in G4EventManager::DoProcessing(G4Event_) () from /opt/fairsoft/install/lib/libG4event.so\*  
_#13 0x00007f669da4fc14 in G4WorkerRunManager::DoEventLoop(int, char const_, int) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#14 0x00007f669da43c5e in G4RunManager::BeamOn(int, char const_, int) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#15 0x00007f669da513a4 in G4WorkerRunManager::DoWork() () from /opt/fairsoft/install/lib/libG4run.so_  
_#16 0x00007f669da5aaa1 in G4MTRunManagerKernel::StartThread(G4WorkerThread_) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#17 0x00007f66b2e0bed0 in ?? () from /usr/lib/x86\_64-linux-gnu/libstdc++.so.6_  
_#18 0x00007f66b2a83ea7 in start\_thread (arg=) at pthread\_create.c:477_  
_#19 0x00007f66b2c5bd4f in clone () at …/sysdeps/unix/sysv/linux/x86\_64/clone.S:95_

_Thread 1 (Thread 0x7f66b2932980 (LWP 4132) “root.exe”):_  
_#0 futex\_wait\_cancelable (private=0, expected=0, futex\_word=0x560d5b05a5ec) at …/sysdeps/nptl/futex-internal.h:183_  
_#1 \_\_pthread\_cond\_wait\_common (abstime=0x0, clockid=0, mutex=0x560d5b05a598, cond=0x560d5b05a5c0) at pthread\_cond\_wait.c:508_  
_#2 \_\_pthread\_cond\_wait (cond=0x560d5b05a5c0, mutex=0x560d5b05a598) at pthread\_cond\_wait.c:638_  
_#3 0x00007f66b2e0690c in std::condition\_variable::wait(std::unique\_lockstd::mutex&) () from /usr/lib/x86\_64-linux-gnu/libstdc++.so.6_  
_#4 0x00007f669cddbdaa in G4MTBarrier::Wait() () from /opt/fairsoft/install/lib/libG4global.so_  
_#5 0x00007f669da4e93c in G4MTRunManager::RunTermination() () from /opt/fairsoft/install/lib/libG4run.so_  
_#6 0x00007f669da43c67 in G4RunManager::BeamOn(int, char const_, int) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#7 0x00007f669e276d75 in TG4RunManager::ProcessRun(int) () from /opt/fairsoft/install/lib/libgeant4vmc.so_  
_#8 0x00007f66a76e3c3c in FairMCApplication::RunMC (this=0x560d581bff90, nofEvents=100) at /opt/fairroot/base/sim/FairMCApplication.cxx:465_  
_#9 0x00007f66a7adbc95 in ?? ()_  
_#10 0x0000560d5a0241b0 in ?? ()_  
_#11 0x00007f66aff4b20e in std::\_Hashtable\<unsigned int, std::pair\<unsigned int const, llvm::SmallVector\<llvm::RelocationEntry, 64u\> \>, std::allocator\<std::pair\<unsigned int const, llvm::SmallVector\<llvm::RelocationEntry, 64u\> \> \>, std::\_\_detail::\_Select1st, std::equal\_to, std::hash, std::\_\_detail::\_Mod\_range\_hashing, std::\_\_detail::\_Default\_ranged\_hash, std::\_\_detail::\_Prime\_rehash\_policy, std::\_\_detail::\_Hashtable\_traits\<false, false, true\> \>::\_M\_insert\_unique\_node(unsigned int const&, unsigned long, unsigned long, std::\_\_detail::\_Hash\_node\<std::pair\<unsigned int const, llvm::SmallVector\<llvm::RelocationEntry, 64u\> \>, false\>_, unsigned long) [clone .isra.0] () from /opt/fairsoft/install/lib/root/libCling.so\*  
_#12 0x00007f66b2c95ad4 in do\_sym (handle=, name=0x560d5960bcf0 “Object array iterator”, who=0x7f66b1a67afc \<llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(char const_)+892\>, vers=0x0, flags=) at dl-sym.c:165\*  
_#13 0x0000560d5d2eaf30 in ?? ()_  
_#14 0x0000560d5d2eaf30 in ?? ()_  
_#15 0x0000560d5d2eaf30 in ?? ()_  
_#16 0x0000560d5d2eaf30 in ?? ()_  
_#17 0x0000560d5d2eaf30 in ?? ()_  
_#18 0x0000560d54ba37d0 in ?? ()_  
_#19 0x0000560d54ba37d0 in ?? ()_  
_#20 0x0000560d59d02e20 in ?? ()_  
_#21 0x0000560d5a11eb60 in ?? ()_  
_#22 0x0000560d5a11eb60 in ?? ()_  
_#23 0x0000560d5a11eb60 in ?? ()_  
_#24 0x0000000000000000 in ?? ()_  
_===========================================================_

_The lines below might hint at the cause of the crash._  
_You may get help by asking at the ROOT forum [http://root.cern.ch/forum](http://root.cern.ch/forum)_  
_Only if you are really convinced it is a bug in ROOT then please submit a_  
_report at [http://root.cern.ch/bugs](http://root.cern.ch/bugs) Please post the ENTIRE stack trace_  
_from above as an attachment in addition to anything else_  
_that might help us fixing this issue._  
_===========================================================_  
_#6 0x00007f66a72b535d in TGeoVolumeAssembly::SetNextNodeIndex(int) () from /opt/fairsoft/install/lib/root/libGeom.so.6.16_  
_#7 0x00007f66a728500f in TGeoShapeAssembly::DistFromOutside(double const_, double const\*, int, double, double\*) const [clone .part.0] () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#8 0x00007f66a7285173 in TGeoShapeAssembly::DistFromOutside(double const_, double const\*, int, double, double\*) const [clone .part.0] () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#9 0x00007f66a72528f7 in TGeoNavigator::FindNextDaughterBoundary(double_, double\*, int&, bool) () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#10 0x00007f66a7256973 in TGeoNavigator::FindNextBoundary(double, char const_, bool) () from /opt/fairsoft/install/lib/root/libGeom.so.6.16\*  
_#11 0x00007f669e177b44 in TG4RootNavigator::ComputeStep(CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const&, double, double&) () from /opt/fairsoft/install/lib/libg4root.so_  
_#12 0x00007f669d0e159e in G4PropagatorInField::ComputeStep(G4FieldTrack&, double, double&, G4VPhysicalVolume_) () from /opt/fairsoft/install/lib/libG4geometry.so\*  
_#13 0x00007f6697828bd2 in G4Transportation::AlongStepGetPhysicalInteractionLength(G4Track const&, double, double, double&, G4GPILSelection_) () from /opt/fairsoft/install/lib/libG4processes.so\*  
_#14 0x00007f669d95c91d in G4SteppingManager::DefinePhysicalStepLength() () from /opt/fairsoft/install/lib/libG4tracking.so_  
_#15 0x00007f669d95acc0 in G4SteppingManager::Stepping() () from /opt/fairsoft/install/lib/libG4tracking.so_  
_#16 0x00007f669d9663ff in G4TrackingManager::ProcessOneTrack(G4Track_) () from /opt/fairsoft/install/lib/libG4tracking.so\*  
_#17 0x00007f669d9a3cd2 in G4EventManager::DoProcessing(G4Event_) () from /opt/fairsoft/install/lib/libG4event.so\*  
_#18 0x00007f669da4fc14 in G4WorkerRunManager::DoEventLoop(int, char const_, int) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#19 0x00007f669da43c5e in G4RunManager::BeamOn(int, char const_, int) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#20 0x00007f669da513a4 in G4WorkerRunManager::DoWork() () from /opt/fairsoft/install/lib/libG4run.so_  
_#21 0x00007f669da5aaa1 in G4MTRunManagerKernel::StartThread(G4WorkerThread_) () from /opt/fairsoft/install/lib/libG4run.so\*  
_#22 0x00007f66b2e0bed0 in ?? () from /usr/lib/x86\_64-linux-gnu/libstdc++.so.6_  
_#23 0x00007f66b2a83ea7 in start\_thread (arg=) at pthread\_create.c:477_  
_#24 0x00007f66b2c5bd4f in clone () at …/sysdeps/unix/sysv/linux/x86\_64/clone.S:95_

_===========================================================_

_Root \> [INFO] Filling MCTrack array…_  
_[INFO] Number of primaries = 10_  
_[INFO] Total number of particles = 208_  
_[INFO] Number of tracks in output = 10_  
_[INFO] Updating track indizes…_  
_[INFO] …stack and 7 collections updated._

- \*\*\* Break \*\*\* segmentation violation\*

_ROOT Version:_ 6 // FairRoot  
_Platform:_ Debian 11  
_Compiler:_ Gcc 10.0.2

* * *

---

<div class="post-metadata">

**Author:** ![agheata](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/agheata/32/37311_2.png) [@agheata](https://root-forum.cern.ch/u/agheata)\
**Post date:** [November 20, 2020, 4:47pm UTC](https://root-forum.cern.ch/t/segmentation-violation-geant4-mt-build-fairrunsim/42376/2 "2020-11-20T16:47:20Z")

</div>

Hi, very hard to say just from the trace which shows a standard Geant4\_VMC calling sequence dying in geometry in a setter, which signals a corrupted pointer. You may need to run again with a Debug build and print the state (data members and local variables) when the crash happens.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [November 20, 2020, 6:10pm UTC](https://root-forum.cern.ch/t/segmentation-violation-geant4-mt-build-fairrunsim/42376/3 "2020-11-20T18:10:11Z")

</div>

@agheata

You should check stack trace - segfault comes from debug part of the code, which disabled by default - I guess. Not sure if this code regularly tested and all threads data (where it fails) initialized correctly.
