| Summary: | crash in G4SteppingManager::InvokeAtRestDoItProcs() | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Witold.Pokorski |
| Component: | tracking | Assignee: | Takashi.Sasaki |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | other | ||
| Hardware: | PC | ||
| OS: | Linux | ||
Please check the processes return DBL_MAX or less for the lifetime. Hi Hisaya, somehow Takashi forwarded this to me. It seems that Decay is the process in question. Note also that it would be better to catch such cases at the level of process management, since it may also happen elsewhere. Many greetings, Hans-Peter. G4Decay (and some other processes) may return "inf" as a result of GPIL methods. MeanLifeTime is set to DBL_MAX if the particle is stable. If theNumberOfInteractionLength is greater than 1, result of GPIL becomes "inf". If all processes return "inf", fAtRestDoItProcTriggered is not initialized and crash may happen. There was an uninitialised variable in the method. The fix is already committed in the repository with the tag tracking-V05-00-02. |
I have been getting a crash from G4SteppingManager::InvokeAtRestDoItProcs() in the following situation: - the particle for which it is called is a neutron - the MAXofAtRestLoops=1 - FCurrentProcess becomes then of type fDecay - lifetime is assigned to be "inf" - I presume that's ok since the neutron is stable in G4 now, when it goes to if(lifeTime < shortestLifeTime ){ shortestLifeTime = lifeTime; fAtRestDoItProcTriggered = G4int(int(ri)); } the condition is not satified because "inf" is not < MAX_DBL and therefore it leaves the whole "ri" loop without touching fAtRestDoItProcTriggered when it reaches then (*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = NotForced; fAtRestDoItProcTriggered has an unitialized value, which results in a segmentation fault. So, basically it seems that this code: for( size_t ri=0 ; ri < MAXofAtRestLoops ; ri++ ){ fCurrentProcess = (*fAtRestGetPhysIntVector)[ri]; if (fCurrentProcess== NULL) { (*fSelectedAtRestDoItVector)[ri] = InActivated; NofInactiveProc++; continue; } // NULL means the process is inactivated by a user on fly. lifeTime = fCurrentProcess->AtRestGPIL( *fTrack, &fCondition ); if(fCondition==Forced){ (*fSelectedAtRestDoItVector)[ri] = Forced; } else{ (*fSelectedAtRestDoItVector)[ri] = InActivated; if(lifeTime < shortestLifeTime ){ shortestLifeTime = lifeTime; fAtRestDoItProcTriggered = G4int(int(ri)); } } } cannot deal with cases when lifetime is infinite. A fix would be to add fAtRestDoItProcTriggered = 0; at the begining of the method.