Geant4 program break down "randomly"

I have a Geant4 program simulating hadrons incident a shashlik calorimeter. I found that the program might break down “randomly”. Sometimes it could finish 10000 events, while sometime it will break down after several hundred of examples.
I tried setting the verbose level of run to 2 and the verbose level of physics to 1.The output infomation was still just “Segmentation fault”.

_Geant4 Version:_10.7.p03
_Operating System:_ubuntu20.04
Compiler/Version:
CMake Version:


Hi,
Could you provide more information on your output ? There is a debug mode to help find less visible issues : https://geant4-forum.web.cern.ch/t/error-segmentation-fault-core-dump/10918/2

Happy coding !

1 Like

Thank you.
I am tring to run in debug mode. But I don’t know when the program will break down. It could happen in several hours or several days.
I will update the infomation when it happens.

There is still not too much infomation.

G4WT15 > --> Event 600 starts with initial seeds (29272636,61172798).
G4WT31 > --> Event 900 starts with initial seeds (39147869,16921800).

Thread 27 "LSShashlik" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff957fa700 (LWP 3982584)]
0x00007ffff577fad7 in G4TouchableHistory::GetVolume(int) const ()
   from /home/llm/software/geant4/install/lib/libG4digits_hits.so
(gdb)

Hi,
Indeed, I encountered a “Segmentation fault” some time ago and was able to identify with the debug mode. Perhaps someone more knowledgeable might be able to see the source of the issue.
Have a nice day.

Hi @Linmao_Li

Thank you for your post.

To help identifying such rare events, there a procedure one can follow:

  1. Enable saving the seed used to initialize the random engine at the begining of each event. To do so, you can use the following UI command: /random/setSavingFlag true
  2. If a segmentation fault occurs, identify the .rndm file
  3. Restart the simulation with the .rndm file using the following UI commands:
/random/resetEngineFrom currentRun.rndm
/run/beamOn 1

I hope this helps to find the segmentation fault.

Best,
Alvaro