Problem 2502

Summary: Crash during geometry test in multi-threaded simulation
Product: Geant4 Reporter: Michail Axiotis <psaxioti>
Component: geometryAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: minor CC: John.Apostolakis
Priority: P4    
Version: 11.0   
Hardware: PC   
OS: Linux   

Description Michail Axiotis 2022-07-27 09:08:57 CEST
Hi,
I have come across the following situation. When I ask for a geometry test in a multi threaded simulation, while the test runs fine at the master thread when it is run at the threads there is a crash.

The problem was discovered with Geant4 version 10.7.3 and reproduced with version 11.0.2 and is also reported in the following thread https://geant4-forum.web.cern.ch/t/bug-in-geometry-test/8362

Steps to reproduce:
1) Compile B1 basic example
2) Add the command /geometry/test/run after /run/initialize in exampleB1.in macro
3) Run the binary with the exampleB1.in macro

The simulation crashes when it tries to run the geometry test on the different threads (it has already run at the master with no problems). It has been tested with the default (Tasking) and MT run manager types, while with Serial there is no crash.

Trying to debug a little bit seems that the "flow" before the crash is: G4GeometryMessenger::RecursiveOverlapTest
G4GeometryManager::CloseGeometry
G4GeometryManager::BuildOptimisations
Trying to delete some G4SmartVoxelHeader

Best Regards,
Michail
Comment 1 Gabriele Cosmo 2022-08-16 15:46:45 CEST
Thanks for reporting the problem.
Effectively, the process of opening and closing a geometry should be executed only by the master thread and a protection was missing.
The fix will be included in the next release and patch.
Comment 2 John Apostolakis 2022-09-21 18:20:31 CEST
Please note that this fix is included in the recent patch 3 of Geant4 release 11.0