Crash when TrackingAction is used with parallelization

Dear all,

I have a problem by using TrackingAction with parallelization. I want to store information of tracks in a file but I have the following error:

 *** Break *** segmentation violation

 *** Break *** bus error


#5  0x000000000042eaf3 in TrackingAction::PreUserTrackingAction(G4Track const*) ()
#6  0x00007f67ab37de30 in G4TrackingManager::ProcessOneTrack(G4Track*) () from /projects/Geant4_OL9/geant4.10.07-install/lib64/libG4tracking.so
#7  0x00007f67ab3bb354 in G4EventManager::DoProcessing(G4Event*) () from /projects/Geant4_OL9/geant4.10.07-install/lib64/libG4event.so
#8  0x00007f67ab46a8cc in G4WorkerRunManager::DoEventLoop(int, char const*, int) () from /projects/Geant4_OL9/geant4.10.07-install/lib64/libG4run.so
#9  0x00007f67ab45c52e in G4RunManager::BeamOn(int, char const*, int) () from /projects/Geant4_OL9/geant4.10.07-install/lib64/libG4run.so
#10 0x00007f67ab46e0d4 in G4WorkerRunManager::DoWork() () from /projects/Geant4_OL9/geant4.10.07-install/lib64/libG4run.so
#11 0x00007f67ab4778c7 in G4MTRunManagerKernel::StartThread(G4WorkerThread*) () from /projects/Geant4_OL9/geant4.10.07-install/lib64/libG4run.so
#12 0x00007f67a843da14 in execute_native_thread_routine () from /usr/lib64/libstdc++.so.6
#13 0x00007f67a80ff812 in start_thread () from /usr/lib64/libc.so.6
#14 0x00007f67a809f450 in clone3 () from /usr/lib64/libc.so.6

If I run the simulation with a single core, I don’t have this problem.
Any suggestion please?

Christian

Does your tracking action make use of “static” variables? Or does it access a global singleton? There’s a nice section of the documentation on thread safety that might help you with making your code more suitable for multithreaded running. It’s not trivial, and you have to change the way you think about the code.