I am running a very high energy simulation modeling neutrons through a shield. I receive a GHAD segmentation fault (~10% of the time) almost always on Fe, but I've seen it on Ni. In particular, the energy seems almost always to be the same (~950 in what I assume to be MeV). I have included the stack trace generated by the fault. Please let me know if I can do anything helpful (i.e. compile with debug flags which should be easy). This happens with the most recent patch to 4.7.1 (p01) Error: GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD Dumping the registered hadronic state information Nucleus A, Z = 56 26 Projectile was a neutron projectile momentum (px, py, pz) = (-2.19408e-14, 4.78784e-15, 177.824) Projectile energy = 956.245 GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD callback to user-defined or default signal handler *** Break *** segmentation violation Generating stack trace... 0x42029188 in <unknown> from /auto/u/mgmarino/MaGe/bin/MaGe 0x083ee940 in G4NeutronHPContAngularPar::Sample(double, double, double, int, int) + 0x130 from /auto/u/mgmarino/MaGe/bin/MaGe 0x083e756c in G4NeutronHPContEnergyAngular::Sample(double, double, double) + 0x1a4 from /auto/u/mgmarino/MaGe/bin/MaGe 0x083ee2e5 in G4NeutronHPProduct::Sample(double) + 0x14d from /auto/u/mgmarino/MaGe/bin/MaGe 0x083ec4d7 in G4NeutronHPEnAngCorrelation::Sample(double) + 0x367 from /auto/u/mgmarino/MaGe/bin/MaGe 0x083d8eb3 in G4NeutronHPInelasticBaseFS::BaseApply(G4HadProjectile const&, G4ParticleDefinition**, int) + 0x1ba7 from /auto/u/mgmarino/MaGe/bin/MaGe 0x083bb245 in G4NeutronHPNPInelasticFS::ApplyYourself(G4HadProjectile const&) + 0x29 from /auto/u/mgmarino/MaGe/bin/MaGe 0x083978f3 in G4NeutronHPChannel::ApplyYourself(G4HadProjectile const&, int) + 0x2b from /auto/u/mgmarino/MaGe/bin/MaGe 0x083cde4d in G4NeutronHPChannelList::ApplyYourself(G4Element const*, G4HadProjectile const&) + 0x1cd from /auto/u/mgmarino/MaGe/bin/MaGe 0x083aed01 in G4NeutronHPInelastic::ApplyYourself(G4HadProjectile const&, G4Nucleus&) + 0x1f1 from /auto/u/mgmarino/MaGe/bin/MaGe 0x084e8904 in _ZN28G4HadronicInteractionWrapper16ApplyInteractionER15G4HadProjectileR9G4NucleusP21G4HadronicIntera + 0x60 from /auto/u/mgmarino/MaGe/bin/MaGe 0x084e29c4 in G4HadronicProcess::GeneralPostStepDoIt(G4Track const&, G4Step const&) + 0x3c0 from /auto/u/mgmarino/MaGe/bin/MaGe 0x084e6401 in G4HadronInelasticProcess::PostStepDoIt(G4Track const&, G4Step const&) + 0x49 from /auto/u/mgmarino/MaGe/bin/MaGe 0x08964570 in G4SteppingManager::InvokePSDIP(unsigned) + 0x30 from /auto/u/mgmarino/MaGe/bin/MaGe 0x0896450a in G4SteppingManager::InvokePostStepDoItProcs() + 0xaa from /auto/u/mgmarino/MaGe/bin/MaGe 0x08965aec in G4SteppingManager::Stepping() + 0x328 from /auto/u/mgmarino/MaGe/bin/MaGe 0x089597e5 in G4TrackingManager::ProcessOneTrack(G4Track*) + 0x1ed from /auto/u/mgmarino/MaGe/bin/MaGe 0x08909a50 in G4EventManager::DoProcessing(G4Event*) + 0x26c from /auto/u/mgmarino/MaGe/bin/MaGe 0x088f7779 in G4RunManager::DoEventLoop(int, char const*, int) + 0xc5 from /auto/u/mgmarino/MaGe/bin/MaGe 0x088f725c in G4RunManager::BeamOn(int, char const*, int) + 0x44 from /auto/u/mgmarino/MaGe/bin/MaGe 0x089001ef in G4RunMessenger::SetNewValue(G4UIcommand*, G4String) + 0x7db from /auto/u/mgmarino/MaGe/bin/MaGe 0x08ac3154 in G4UIcommand::DoIt(G4String) + 0xd0 from /auto/u/mgmarino/MaGe/bin/MaGe 0x08ad0d13 in G4UImanager::ApplyCommand(char const*) + 0x54b from /auto/u/mgmarino/MaGe/bin/MaGe 0x08ad9b56 in G4UIbatch::SessionStart() + 0x202 from /auto/u/mgmarino/MaGe/bin/MaGe 0x08acef65 in G4UImanager::ExecuteMacroFile(char const*) + 0x31 from /auto/u/mgmarino/MaGe/bin/MaGe 0x08ade84f in G4UIcontrolMessenger::SetNewValue(G4UIcommand*, G4String) + 0x2b3 from /auto/u/mgmarino/MaGe/bin/MaGe
I have run the program (compiling with symbols) with valgrind and have seen the following message: ==28972== ==28972== Invalid read of size 4 ==28972== at 0x843B8A3: G4ParticleDefinition::GetPDGMass() const (/auto/common/majorana/simu/geant4.7.1.p01/include/G4ParticleDefinition.hh:111) ==28972== by 0x8594E81: G4NeutronHPContAngularPar::Sample(double, double, double, int, int) (G4NeutronHPContAngularPar.cc:95) ==28972== by 0x858ECB3: G4NeutronHPContEnergyAngular::Sample(double, double, double) (G4NeutronHPContEnergyAngular.cc:61) ==28972== by 0x859454B: G4NeutronHPProduct::Sample(double) (G4NeutronHPProduct.cc:47) ==28972== Address 0x10 is not stack'd, malloc'd or free'd Perhaps a read error from a data file?
I have created a standalone geant4 program and have found a seed which will reproduce the error. The error I receive this time: GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD Dumping the registered hadronic state information Nucleus A, Z = 56 26 Projectile was a neutron projectile momentum (px, py, pz) = (0, 0, 193.904) Projectile energy = 959.366 GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD_GHAD I have some more debugging information garnered from gdb, which is slightly more useful as it has the value of data members making the error more transparent: [Switching to Thread 4135344352 (LWP 7106)] 0x082054e2 in G4ParticleDefinition::GetPDGMass (this=0x0) at G4ParticleDefinition.hh:111 111 G4ParticleDefinition.hh: No such file or directory. in G4ParticleDefinition.hh (gdb) where #0 0x082054e2 in G4ParticleDefinition::GetPDGMass (this=0x0) at G4ParticleDefinition.hh:111 #1 0x08591f25 in G4ReactionProduct::SetDefinition (this=0xadeb830, aParticleDefinition=0x0) at src/G4ReactionProduct.cc:154 #2 0x082812a7 in G4NeutronHPContAngularPar::Sample (this=0xa2e4ccc, anEnergy=19.799897131918897, massCode=27026, angularRep=1) at src/G4NeutronHPContAngularPar.cc:95 #3 0x0827b37e in G4NeutronHPContEnergyAngular::Sample (this=0xa2d3f48, anEnergy=19.799897131918897, massCode=27026) at src/G4NeutronHPContEnergyAngular.cc:61 #4 0x08280977 in G4NeutronHPProduct::Sample (this=0xa2d3a94, anEnergy=19.799897131918897) at src/G4NeutronHPProduct.cc:47 #5 0x0827efae in G4NeutronHPEnAngCorrelation::Sample (this=0xa2d3800, anEnergy=19.799897131918897) at src/G4NeutronHPEnAngCorrelation.cc:90 #6 0x0826cea8 in G4NeutronHPInelasticBaseFS::BaseApply (this=0xa2b8108, theTrack=@0xffffc910, theDefs=0xffffc670, nDef=2) at src/G4NeutronHPInelasticBaseFS.cc:226 #7 0x08250c53 in G4NeutronHPNPInelasticFS::ApplyYourself (this=0xa2b8108, theTrack=@0xffffc910) at src/G4NeutronHPNPInelasticFS.cc:40 #8 0x082346cc in G4NeutronHPChannel::ApplyYourself (this=0xa2ad8d0, theTrack=@0xffffc910, anIsotope=3) at src/G4NeutronHPChannel.cc:188 #9 0x08264881 in G4NeutronHPChannelList::ApplyYourself (this=0x991c8c4, aTrack=@0xffffc910) at src/G4NeutronHPChannelList.cc:124 #10 0x08246da8 in G4NeutronHPInelastic::ApplyYourself (this=0x998a328, aTrack=@0xffffc910) at src/G4NeutronHPInelastic.cc:140 #11 0x0828fc29 in G4HadronicInteractionWrapper::ApplyInteraction (this=0xffffc90b, thePro=@0xffffc910, targetNucleus=@0x95b0950, theInteraction=0x998a328) at src/G4HadronicInteractionWrapper.cc:33 #12 0x08287f40 in G4HadronicProcess::GeneralPostStepDoIt (this=0x95b06c0, aTrack=@0xade1ef0) at src/G4HadronicProcess.cc:394 #13 0x0828d559 in G4HadronInelasticProcess::PostStepDoIt (this=0x95b06c0, aTrack=@0xade1ef0, aStep=@0x9599ab0) at src/G4HadronInelasticProcess.cc:77 #14 0x085d5bab in G4SteppingManager::InvokePSDIP (this=0x95999a0, np=2) at src/G4SteppingManager2.cc:465 #15 0x085d5adc in G4SteppingManager::InvokePostStepDoItProcs (this=0x95999a0) at src/G4SteppingManager2.cc:442 #16 0x085d7aed in G4SteppingManager::Stepping (this=0x95999a0) at src/G4SteppingManager.cc:196 #17 0x085caea4 in G4TrackingManager::ProcessOneTrack (this=0x9599978, apValueG4Track=0xade1ef0) at src/G4TrackingManager.cc:118 #18 0x085bbef3 in G4EventManager::DoProcessing (this=0x9599938, anEvent=0xade0f10) at src/G4EventManager.cc:174 #19 0x085bc57a in G4EventManager::ProcessOneEvent (this=0x9599938, anEvent=0xade0f10) at src/G4EventManager.cc:324 #20 0x0859782b in G4RunManager::DoEventLoop (this=0x9599870, n_event=10000, macroFile=0x0, n_select=-1) at src/G4RunManager.cc:219 #21 0x08597305 in G4RunManager::BeamOn (this=0x9599870, n_event=10000, macroFile=0x0, n_select=-1) at src/G4RunManager.cc:128 #22 0x0859d2ca in G4RunMessenger::SetNewValue (this=0x95a6a78, command=0x95a6dd0, newValue= {<std::basic_string<char,std::char_traits<char>,std::allocator<char> >> = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0xad2287c "10000 ***NULL*** -1"}}, _vptr.G4String = 0x874d980}) at src/G4RunMessenger.cc:248 #23 0x08720b56 in G4UIcommand::DoIt (this=0x95a6dd0, parameterList= {<std::basic_string<char,std::char_traits<char>,std::allocator<char> >> = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0xacf92dc "10000"}}, _vptr.G4String = 0x874d980}) at src/G4UIcommand.cc:206 #24 0x08728f8e in G4UImanager::ApplyCommand (this=0x9599f00, aCmd=0x874c870 "/run/beamOn 10000") at src/G4UImanager.cc:397 #25 0x081ff5be in main () at SLACBD.cc:63 Digging slightly deeper: #2 0x082812a7 in G4NeutronHPContAngularPar::Sample (this=0xa2e4ccc, anEnergy=19.799897131918897, massCode=27026, angularRep=1) at src/G4NeutronHPContAngularPar.cc:95 95 result->SetDefinition(G4ParticleTable::GetParticleTable()->FindIon(Z,A,0,Z)); with A = 26, Z = 27. (values read out from gdb) It looks as though the ParticleTable is unable to find the appropriate ion and passes a NULL value which causes the Seg fault. My standalone program essentially shoots neutrons of 19.8 Mev energy at steel (which is mostly Iron (7/10) with a slight amount of Nickel (2/10) and Chromium (1/10)). I am using basically the QGSP_HP Hadronic Physics List. I would be happy to send the program along if that would be helpful. It usually takes roughly 1000 events (< 5 minutes on an x86 ~2GHz) to find a seed which will reproduce the error. Please feel free to email me.
I have done some more digging, and have found that the massCode (=27026) which generates the erroneous Z and A( < Z!) values comes from the directory /path/to/G4NDL3.7/Inelastic/F10. Grepping the directory for 27026 the file 28_62_Nickel comes up. I checked the file and values adjacent to this value correspond to the values that I can find (using gdb) which were read in to from a database file. I subsequently removed Nickel from my msterial (Steel) in the simulation, and this completely removed the GHAD problem. I ran 100 different processes (with different seeds of course) with 10000 events and found no GHAD errors. Previously, I expected ~20 errors (20 failures) when running that many processes. I imagine a new bug report should be opened for the database file: G4NDL3.7/Inelastic/F10/28_62_Nickel with special note to look for massCode 27026.
This problems perhaps no longer applies, but was assigned to the wrong responsible. Assigning it to the responsible for the Neutron code for verification ...
I just checked this problem by 1 GeV neutrons bombarding Iron slab. The problem does not happen with ~16k incidence neutrons. Therefore I changed status of this entry to “RESOLVED-FIXED”. The version of Geanrt4 which I checked is v9.3.p01 Tatsumi