G4Exception: Cache001

Hello,

I get an error message at the very end of my application. It seems that the simulation runs well and the results look also valid to me. However, Geant4 (4-10-07-patch02, also tested with latest 4.11 Beta relase) raises an exception at the very end (full G4Backtrace below):

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** ExceptionHandler is not defined ***
*** G4Exception : Cache001
issued by : G4CacheReference::Destroy
Internal fatal error. Invalid G4Cache size (requested id: 6 but cache has size: 5 Possibly client created G4Cache object in a thread and tried to delete it from another thread!
*** Fatal Exception ***
-------- EEEE ------- G4Exception-END -------- EEEE -------

This exception only occurs when I simulate less than ~20primaries, but not always, so it seems that this error is not completely reproducible. When simulating more than 100primariers I was not able to get this exception.

I would like to know, whether this error indicates a severe problem or whether I can ignore it, since my results look valid. Ideally, of course, we can find the reason for this…but I do not even know where to start looking. Any help appriciated!

PS: I compiled Geant in single threaded mode and I therefore use the single threaded runmanager.

Thanks,
Steffen


-------- EEEE ------- G4Exception-START -------- EEEE -------

*** ExceptionHandler is not defined ***
*** G4Exception : Cache001
issued by : G4CacheReference::Destroy
Internal fatal error. Invalid G4Cache size (requested id: 12 but cache has size: 11 Possibly client created G4Cache object in a thread and tried to delete it from another thread!
*** Fatal Exception ***
-------- EEEE ------- G4Exception-END -------- EEEE -------

*** G4Exception: Aborting execution ***

CAUGHT SIGNAL: 6 ### address: 0x3e8000049af, signal = SIGABRT, value = 6, description = abort program (formerly SIGIOT).

Backtrace:
[PID=18863, TID=-2][ 0/14]> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x141) [0x7fdca3f96ce1]
[PID=18863, TID=-2][ 1/14]> /lib/x86_64-linux-gnu/libc.so.6(abort+0x123) [0x7fdca3f80537]
[PID=18863, TID=-2][ 2/14]> /opt/geant4/lib/libG4global.so(Z11G4ExceptionPKcS0_19G4ExceptionSeverityS0+0x10cc) [0x7fdca455d72c]
[PID=18863, TID=-2][ 3/14]> /opt/geant4/lib/libG4global.so(_Z11G4ExceptionPKcS0_19G4ExceptionSeverityRNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEE+0xe0) [0x7fdca455d8c0]
[PID=18863, TID=-2][ 4/14]> /opt/geant4/lib/libG4event.so(+0x55e69) [0x7fdca4ceae69]
[PID=18863, TID=-2][ 5/14]> /opt/geant4/lib/libG4event.so(_ZN7G4CacheIN20G4SPSPosDistribution13thread_data_tEED1Ev+0x5a) [0x7fdca4ceb16a]
[PID=18863, TID=-2][ 6/14]> /opt/geant4/lib/libG4event.so(_ZN20G4SPSPosDistributionD1Ev+0x10) [0x7fdca4ce53c0]
[PID=18863, TID=-2][ 7/14]> /opt/geant4/lib/libG4event.so(_ZN22G4SingleParticleSourceD1Ev+0x47) [0x7fdca4cf26a7]
[PID=18863, TID=-2][ 8/14]> /opt/geant4/lib/libG4event.so(_ZN22G4SingleParticleSourceD0Ev+0x9) [0x7fdca4cf2719]
[PID=18863, TID=-2][ 9/14]> /opt/geant4/lib/libG4event.so(_ZN27G4GeneralParticleSourceDataD1Ev+0x2a) [0x7fdca4cba19a]
[PID=18863, TID=-2][10/14]> /lib/x86_64-linux-gnu/libc.so.6(+0x3e4d7) [0x7fdca3f994d7]
[PID=18863, TID=-2][11/14]> /lib/x86_64-linux-gnu/libc.so.6(+0x3e67a) [0x7fdca3f9967a]
[PID=18863, TID=-2][12/14]> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7fdca3f81d11]
[PID=18863, TID=-2][13/14]> ./Simulator(+0x1581a) [0x55f63203e81a]

: Aborted (Signal sent by tkill() 18863 1000)
Aborted

In the meanwhile I found out, that this exception is only raised, when more than one GPS Source is added via “/gps/source/add”.

Maybe this helps to track down the cause for this. Any help/hint appreciated!
Cheers,
Steffen

Hello,

we get the same error message at the very end of the job:

Graphics systems deleted.
Visualization Manager deleting...
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 14; of which, static: 0
Dynamic pools deleted: 14 / Total memory freed: 0.05 MB
============================================================
RunManagerKernel is deleted. Good bye :)

-------- EEEE ------- G4Exception-START -------- EEEE -------

*** ExceptionHandler is not defined ***
*** G4Exception : Cache001
      issued by : G4CacheReference<V>::Destroy
Internal fatal error. Invalid G4Cache size (requested id: 7 but cache has size: 3 Possibly client created G4Cache object in a thread and tried to delete it from another thread!
*** Fatal Exception ***
-------- EEEE ------- G4Exception-END -------- EEEE -------


*** G4Exception: Aborting execution ***

This is the gdb-backtrace:

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x000015554bf6b535 in __GI_abort () at abort.c:79
#2  0x000015554c6af372 in G4Exception (
    originOfException=0x15555082bf6a "G4CacheReference<V>::Destroy", 
    exceptionCode=0x15555082bf61 "Cache001", severity=FatalException, 
    description=0x55555aab3140 "Internal fatal error. Invalid G4Cache size (requested id: 7 but cache has size: 3 Possibly client created G4Cache object in a thread and tried to delete it from another thread!")
    at /software/geant4-v11.0.2/source/global/management/src/G4Exception.cc:88
#3  0x000015554c6af549 in G4Exception (
    originOfException=0x15555082bf6a "G4CacheReference<V>::Destroy", 
    exceptionCode=0x15555082bf61 "Cache001", severity=FatalException, 
    description=...)
    at /software/geant4-v11.0.2/source/global/management/src/G4Exception.cc:104
#4  0x0000155550813b95 in G4CacheReference<G4SPSRandomGenerator::a_check>::Destroy (this=0x555555af28f4, id=7, last=false)
    at /software/geant4-v11.0.2/source/global/management/include/G4CacheDetails.hh:170
#5  0x00001555508132f6 in G4Cache<G4SPSRandomGenerator::a_check>::~G4Cache (
    this=0x555555af28e8, __in_chrg=<optimized out>)
    at /software/geant4-v11.0.2/source/global/management/include/G4Cache.hh:306
#6  0x000015555080f772 in G4SPSRandomGenerator::~G4SPSRandomGenerator (
    this=0x555555af2060, __in_chrg=<optimized out>)
    at /software/geant4-v11.0.2/source/event/src/G4SPSRandomGenerator.cc:88
#7  0x0000155550816d3e in G4SingleParticleSource::~G4SingleParticleSource (
    this=0x555555af1f60, __in_chrg=<optimized out>)
    at /software/geant4-v11.0.2/source/event/src/G4SingleParticleSource.cc:85
#8  0x0000155550816dfe in G4SingleParticleSource::~G4SingleParticleSource (
    this=0x555555af1f60, __in_chrg=<optimized out>)
    at /software/geant4-v11.0.2/source/event/src/G4SingleParticleSource.cc:91
#9  0x00001555507d9ce0 in G4GeneralParticleSourceData::~G4GeneralParticleSourceData (this=0x155550853020 <G4GeneralParticleSourceData::Instance()::instance>, 
    __in_chrg=<optimized out>)
    at /software/geant4-v11.0.2/source/event/src/G4GeneralParticleSourceData.cc:58
#10 0x000015554bf82d8c in __run_exit_handlers (status=0, 
    listp=0x15554c104718 <__exit_funcs>, 
    run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true)
    at exit.c:108
#11 0x000015554bf82eba in __GI_exit (status=<optimized out>) at exit.c:139
#12 0x000015554bf6d0a2 in __libc_start_main (main=
    0x55555556cd35 <main(int, char**)>, argc=2, argv=0x7fffffffd828, 
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffd818) at ../csu/libc-start.c:342
#13 0x000055555556cc7a in _start ()

Could there be a problem with the G4SPSRandomGenerator cleanup?