| Summary: | Crash when running more then 1 thread in MT mode | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | davidl |
| Component: | geometry/divisions | Assignee: | Pedro.Arce |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P5 | ||
| Version: | 10.1 | ||
| Hardware: | Apple | ||
| OS: | Mac OS X | ||
| Attachments: | .cc and .hh file | ||
Created attachment 346 [details]
.cc and .hh file
Avoid creation - deletion of rotation matrix in G4VDivisionParameterisation by making the rotation matrix a data *** Problem 1758 has been marked as a duplicate of this problem. *** |
I am having some trouble with crashes when running multi-threaded. I am reading the geometry from a GDML file (that itself is created using ROOT). The problem is that when I run with multiple threads, I get a crash that the debugger says comes from a double free in this routine: G4VDivisionParameterisation::ChangeRotMatrix Looking at the source, it appears that the navigation is deleting and replacing a rotation matrix in a physical volume object. This would seem to be a problem if multiple threads are trying to do this with a single physical volume object simultaneously. Is there something else that I need to do to force the tracking to happen in a thread-safe manner? Is there an issue with using GDML generated geometry with multiple threads? I am running this using geant4 version 10.01.p01 on Mac OS X 10.9.5. I have been able to compile and run the B3 example multi-threaded and it seems to work OK. I’ve included the thread list and full backtrace of the thread that is dying below. The error message printed by the Geant4 application is: D2(90323,0x112c04000) malloc: *** error for object 0x110bb7670: pointer being freed was not allocated Any help would be appreciated. ------------------------------------------------------------------------- (lldb) thread list Process 90323 stopped thread #1: tid = 0x11e6a86, 0x00007fff85b0c716 libsystem_kernel.dylib`__psynch_cvwait + 10, queue = 'com.apple.main-thread' thread #3: tid = 0x11e6aac, 0x00007fff85b0d662 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager' thread #6: tid = 0x11e6bb1, 0x0000000100fbe26c libG4processes.dylib`G4ElectroNuclearCrossSection::GetFunctions(this=0x0000000101c1d4e0, a=<unavailable>, xx=0x000000011619ca00, yy=0x000000011619d600, zz=0x000000011619e200) + 444 at G4ElectroNuclearCrossSection.cc:2417 * thread #5: tid = 0x11e6bb2, 0x00007fff85b0c866 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT thread #7: tid = 0x11e6bb3, 0x00000001027c1ab5 libG4geometry.dylib`G4VoxelNavigation::LocateNextVoxel(CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const&, double) [inlined] G4SmartVoxelProxy::IsNode(this=0x000000010ec953b0) const at G4SmartVoxelProxy.icc:43 thread #8: tid = 0x11e6bb4, 0x0000000100fbe26c libG4processes.dylib`G4ElectroNuclearCrossSection::GetFunctions(this=0x0000000101c1d4e0, a=<unavailable>, xx=0x0000000107ac8e00, yy=0x0000000107ac9a00, zz=0x0000000107aca600) + 444 at G4ElectroNuclearCrossSection.cc:2417 (lldb) bt * thread #5: tid = 0x11e6bb2, 0x00007fff85b0c866 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT * frame #0: 0x00007fff85b0c866 libsystem_kernel.dylib`__pthread_kill + 10 frame #1: 0x00007fff836a335c libsystem_pthread.dylib`pthread_kill + 92 frame #2: 0x00007fff8e8d3b1a libsystem_c.dylib`abort + 125 frame #3: 0x00007fff8cd1007f libsystem_malloc.dylib`free + 411 frame #4: 0x000000010274e136 libG4geometry.dylib`G4VDivisionParameterisation::ChangeRotMatrix(this=<unavailable>, physVol=0x000000010e7eff80, rotZ=<unavailable>) const + 150 at G4VDivisionParameterisation.cc:95 frame #5: 0x00000001027a899b libG4geometry.dylib`G4ParameterisedNavigation::LevelLocate(G4NavigationHistory&, G4VPhysicalVolume const*, int, CLHEP::Hep3Vector const&, CLHEP::Hep3Vector const*, bool, CLHEP::Hep3Vector&) [inlined] G4ParameterisedNavigation::IdentifyAndPlaceSolid(this=<unavailable>, num=<unavailable>, apparentPhys=<unavailable>, curParam=<unavailable>) + 763 at G4ParameterisedNavigation.icc:48 frame #6: 0x00000001027a8955 libG4geometry.dylib`G4ParameterisedNavigation::LevelLocate(this=<unavailable>, history=0x0000000110bfb970, blockedVol=0x0000000000000000, blockedNum=-1, globalPoint=0x0000000114eada40, globalDirection=0x0000000114ead7a0, pLocatedOnEdge=<unavailable>, localPoint=<unavailable>) + 693 at G4ParameterisedNavigation.cc:614 frame #7: 0x000000010279a7e6 libG4geometry.dylib`G4Navigator::LocateGlobalPointAndSetup(this=0x0000000110bfb960, globalPoint=0x0000000114eada40, pGlobalDirection=0x0000000114ead7a0, relativeSearch=<unavailable>, ignoreDirection=<unavailable>) + 4742 at G4Navigator.cc:473 frame #8: 0x00000001014ffd45 libG4processes.dylib`G4Navigator::LocateGlobalPointAndUpdateTouchableHandle(this=0x0000000110bfb960, position=<unavailable>, direction=<unavailable>, oldTouchableToUpdate=0x0000000114d576d8, RelativeSearch=<unavailable>) + 37 at G4Navigator.icc:294 frame #9: 0x00000001014ff8ba libG4processes.dylib`G4Transportation::PostStepDoIt(this=0x0000000114d574e0, track=<unavailable>, (null)=<unavailable>) + 106 at G4Transportation.cc:669 frame #10: 0x0000000100c22d6e libG4tracking.dylib`G4SteppingManager::InvokePSDIP(this=0x0000000110bfb340, np=<unavailable>) + 62 at G4SteppingManager2.cc:530 frame #11: 0x0000000100c22c6b libG4tracking.dylib`G4SteppingManager::InvokePostStepDoItProcs(this=0x0000000110bfb340) + 139 at G4SteppingManager2.cc:502 frame #12: 0x0000000100c2077a libG4tracking.dylib`G4SteppingManager::Stepping(this=0x0000000110bfb340) + 858 at G4SteppingManager.cc:209 frame #13: 0x0000000100c2b221 libG4tracking.dylib`G4TrackingManager::ProcessOneTrack(this=0x0000000110bfb300, apValueG4Track=<unavailable>) + 913 at G4TrackingManager.cc:126 frame #14: 0x0000000100b7de32 libG4event.dylib`G4EventManager::DoProcessing(this=0x0000000110bfb210, anEvent=<unavailable>) + 1826 at G4EventManager.cc:185 frame #15: 0x0000000100b01e8e libG4run.dylib`G4WorkerRunManager::ProcessOneEvent(this=0x0000000110bfafe0, i_event=<unavailable>) + 46 at G4WorkerRunManager.cc:251 frame #16: 0x0000000100b01e1e libG4run.dylib`G4WorkerRunManager::DoEventLoop(this=0x0000000110bfafe0, n_event=<unavailable>, macroFile=<unavailable>, n_select=<unavailable>) + 238 at G4WorkerRunManager.cc:229 frame #17: 0x0000000100af7c83 libG4run.dylib`G4RunManager::BeamOn(this=0x0000000110bfafe0, n_event=10, macroFile=0x0000000000000000, n_select=-1) + 99 at G4RunManager.cc:273 frame #18: 0x0000000100b0ab75 libG4run.dylib`G4MTRunManagerKernel::StartThread(context=<unavailable>) + 1685 at G4MTRunManagerKernel.cc:249 frame #19: 0x00007fff836a2899 libsystem_pthread.dylib`_pthread_body + 138 frame #20: 0x00007fff836a272a libsystem_pthread.dylib`_pthread_start + 137 frame #21: 0x00007fff836a6fc9 libsystem_pthread.dylib`thread_start + 13 (lldb)