Problem 1271

Summary: Memory error in errorpagation test
Product: Geant4 Reporter: Pere Mato <pere.mato>
Component: error_propagationAssignee: Pedro.Arce
Status: RESOLVED FIXED    
Severity: major CC: Gabriele.Cosmo
Priority: P5    
Version: other   
Hardware: All   
OS: All   

Description Pere Mato 2011-12-16 14:11:53 CET
The erropropagation example has been failing on Windows intermittently. See one case in http://cdash.cern.ch/testDetails.php?test=12680&build=661
After debugging it on Windows I concluded that the problem is memory corruption. Running the test with Valgrind you get many memory errors. The first ones are attached. The problem is the deletion of G4navigator in G4ErrorPropagatorManager.cc:140 and it use later in the example. 


==72484== Invalid read of size 8
==72484==    at 0x1750668: G4SteppingManager::SetInitialStep(G4Track*) (G4SteppingManager.cc:303)
==72484==    by 0x1197113: G4ErrorPropagator::InitG4Track(G4ErrorTrajState&) (G4ErrorPropagator.cc:304)
==72484==    by 0x1197BE3: G4ErrorPropagator::Propagate(G4ErrorTrajState*, G4ErrorTarget const*, G4ErrorMode) (G4ErrorPropagator.cc:120)
==72484==    by 0x1199634: G4ErrorPropagatorManager::Propagate(G4ErrorTrajState*, G4ErrorTarget const*, G4ErrorMode) (G4ErrorPropagatorManager.cc:273)
==72484==    by 0x10000B51A: ProcessEvent(int, unsigned long) (errprop.cc:171)
==72484==    by 0x10000D5A4: main (errprop.cc:81)
==72484==  Address 0x1001be810 is 0 bytes inside a block of size 896 free'd
==72484==    at 0xC508: free (vg_replace_malloc.c:430)
==72484==    by 0x4F37D39: G4Navigator::~G4Navigator() (G4Navigator.cc:73)
==72484==    by 0x119A282: G4ErrorPropagatorManager::StartNavigator() (G4ErrorPropagatorManager.cc:140)
==72484==    by 0x119A5E5: G4ErrorPropagatorManager::G4ErrorPropagatorManager() (G4ErrorPropagatorManager.cc:100)
==72484==    by 0x119A622: G4ErrorPropagatorManager::GetErrorPropagatorManager() (G4ErrorPropagatorManager.cc:70)
==72484==    by 0x10000BD58: Initialize() (errprop.cc:95)
==72484==    by 0x10000D0AF: main (errprop.cc:60)
==72484== 
==72484== Invalid write of size 1
==72484==    at 0x4F3614C: G4Navigator::LocateGlobalPointAndSetup(CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const*, bool, bool) (G4Navigator.cc:121)
==72484==    by 0x17506B4: G4SteppingManager::SetInitialStep(G4Track*) (G4SteppingManager.cc:303)
==72484==    by 0x1197113: G4ErrorPropagator::InitG4Track(G4ErrorTrajState&) (G4ErrorPropagator.cc:304)
==72484==    by 0x1197BE3: G4ErrorPropagator::Propagate(G4ErrorTrajState*, G4ErrorTarget const*, G4ErrorMode) (G4ErrorPropagator.cc:120)
==72484==    by 0x1199634: G4ErrorPropagatorManager::Propagate(G4ErrorTrajState*, G4ErrorTarget const*, G4ErrorMode) (G4ErrorPropagatorManager.cc:273)
==72484==    by 0x10000B51A: ProcessEvent(int, unsigned long) (errprop.cc:171)
==72484==    by 0x10000D5A4: main (errprop.cc:81)
==72484==  Address 0x1001be87d is 109 bytes inside a block of size 896 free'd
==72484==    at 0xC508: free (vg_replace_malloc.c:430)
==72484==    by 0x4F37D39: G4Navigator::~G4Navigator() (G4Navigator.cc:73)
==72484==    by 0x119A282: G4ErrorPropagatorManager::StartNavigator() (G4ErrorPropagatorManager.cc:140)
==72484==    by 0x119A5E5: G4ErrorPropagatorManager::G4ErrorPropagatorManager() (G4ErrorPropagatorManager.cc:100)
==72484==    by 0x119A622: G4ErrorPropagatorManager::GetErrorPropagatorManager() (G4ErrorPropagatorManager.cc:70)
==72484==    by 0x10000BD58: Initialize() (errprop.cc:95)
==72484==    by 0x10000D0AF: main (errprop.cc:60)
Comment 1 Gabriele Cosmo 2012-01-26 10:47:33 CET
The fix will be included in the reference tag of January 2012, geant4-09-05-ref-01.