GENIE-MC/Generator

Using genie exception with step back causes segfault

Closed this issue · 2 comments

When the step back operation is executed the code creates a copy of the event record:

event_rec->Copy(*snapshot);

For some reason this creates a segfault:

===========================================================
#7  TIter::TIter (dir=true, col=0x0, this=<synthetic pointer>) at GHepRecord.cxx:907
#8  genie::GHepRecord::Copy (this=0x5277720, record=...) at GHepRecord.cxx:907
#9  0x00007f004853ce06 in genie::EventGenerator::ProcessEventRecord (this=0x4505f60, event_rec=0x5277720) at EventGenerator.cxx:171
#10 0x00007f0048562ca3 in genie::GEVGDriver::GenerateEvent (this=this
entry=0x48f4770, nu4p=...) at GEVGDriver.cxx:286
#11 0x00007f004856f6c1 in genie::GMCJDriver::GenerateEventKinematics (this=0x4e66ab0) at GMCJDriver.cxx:1234
#12 0x00007f004856fc46 in genie::GMCJDriver::GenerateEvent1Try (this=0x4e66ab0) at GMCJDriver.cxx:1004
#13 0x00007f0048570fdc in genie::GMCJDriver::GenerateEvent (this=this
entry=0x4e66ab0) at GMCJDriver.cxx:826
#14 0x0000000000410cc8 in GenerateEventsUsingFluxOrTgtMix () at gEvGen.cxx:382
#15 0x000000000040663f in main (argc=<optimized out>, argv=<optimized out>) at gEvGen.cxx:234
===========================================================

which is related to the invalidation of iterators.
I don't know anything more, but I'm investigating.

It seems it is the snapshot in the history that is not ok in the first place. Event printing the snapshot will cause the segfault.

I think the issue is that the history is only storing the first element. So it's only possible to start from the beginning, not from an intermediate stage.