RunManagerKernel Error when closing UI

_Geant4 Version:11.2.1
_Operating System: macOS Sequoia
_Compiler/Version: XCode 16

Hello everyone,
I am getting this long but harmless error from an edited version of the Geant4GarfieldInterface after running and closing the UI session, it is quite long, so here is a snippet.:

Exception: [code: system:22] caught: mutex lock failed: Invalid argument
Non-critical error: mutex lock failure in ~G4Cache<P15G4HadFinalState>. 
If the RunManagerKernel has been deleted, it failed to delete an allocated resource
and this destructor is being called after the statics were destroyed.

I am getting the same error when running the original example as well. The output is perfectly fine, and the root file and results look decent. I want that error to go away since it is hard to track things well.
I am unsure if anyone has experienced something like this, I’d appreciate the help.

Sincerely,
Khalil

This is likely the same as in Non-critical error: mutex lock failure in MacOS, and Non-critical error when deleting runManager. In the first case, a request was Bugzilla was made to the reporter but not made, so if you want to do this so we can track and refer to things properly, that’d be great, thanks: https://bugzilla-geant4.kek.jp

Pinging also @asaim, @gcosmo for their info.

Hello, thank you for the assistance.
I think the first one includes issues with the Shielding physics list and multithreading.
The second one suggests not deleting runMangaer in main(), I tried that but I am still getting this error. Please if you have any additional suggestions that I can try that would be great :slight_smile:

This is the same bug as here.

My workaround has been to not delete the runManager at the very end of main(). This means not using an auto-pointer for the run manager (as is the current practice in most example applications).

Thank you for the suggestion.

I am not using any auto_ptr in the main() and I am more or less using an example code as well. So the main look identical to the other examples with the Garfield integration. I tried commenting out the delete runManager line at the end but I am still getting the error with the additional errors now:

WARNING - Attempt to delete the assembly store while geometry closed !
WARNING - Attempt to delete the physical volume store while geometry closed !
WARNING - Attempt to delete the logical volume store while geometry closed !
WARNING - Attempt to delete the solid store while geometry closed !
WARNING - Attempt to delete the region store while geometry closed !

I am not sure if that was the exact suggestion or if there was something I missed.
Thank you either way.