Problem 1677

Summary: G4PAIPhotModel: Segmentation fault in destruction phase
Product: Geant4 Reporter: Dorothea Pfeiffer <dorothea.pfeiffer>
Component: processes/electromagneticAssignee: Vladimir.Ivantchenko
Status: RESOLVED FIXED    
Severity: normal    
Priority: P5    
Version: 10.0   
Hardware: All   
OS: Linux   

Description Dorothea Pfeiffer 2014-09-18 10:42:55 CEST
Hi,

I'm experiencing a segmentation fault/core dump at the end of my program
after the deletion of the RunManagerKernel when using the
G4PAIPhotModel. The segmentation fault is reproducable with TestEm8 and
the testPAI.mac macro when using the option

/testem/phys/addPhysics pai_photon

The error occurs with Geant4 version 10.0.p02 and 10.1.beta01.

I'm working on lxplus using csh with the following options:

if ( -r /afs/cern.ch/sw/lcg/contrib/gcc/4.8.0/x86_64-slc6-gcc48-opt/setup.csh ) then
   source /afs/cern.ch/sw/lcg/contrib/gcc/4.8.0/x86_64-slc6-gcc48-opt/setup.csh
endif
if ( -r /afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/bin/geant4.csh ) then
   source /afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/bin/geant4.csh /afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/bin
endif

The relevant valgrind output is here:

[snip]

UImanager deleted.

StateManager deleted.

RunManagerKernel is deleted. Good bye :)

==11699== Invalid read of size 8 ==11699== at 0xA28F399:
G4SandiaTable::~G4SandiaTable() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4materials.so)
==11699== by 0x85C4269: G4PAIxSection::~G4PAIxSection() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x85BD65D: G4PAIPhotModel::~G4PAIPhotModel() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x85BD6F8: G4PAIPhotModel::~G4PAIPhotModel() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x862EA02: G4LossTableManager::~G4LossTableManager() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x86329C5:
G4ThreadLocalSingleton<G4LossTableManager>::Clear() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x8632AB3:
G4ThreadLocalSingleton<G4LossTableManager>::~G4ThreadLocalSingleton()
(in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0xE9DCB31: exit (in /lib64/libc-2.12.so) ==11699== by
0xE9C5D63: (below main) (in /lib64/libc-2.12.so) ==11699== Address
0x173d5160 is 0 bytes inside a block of size 32 free'd ==11699== at
0x4C26FD6: operator delete(void*) (vg_replace_malloc.c:480) ==11699== by
0xA28F39E: G4SandiaTable::~G4SandiaTable() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4materials.so)
==11699== by 0x85BB3C1: G4PAIPhotData::~G4PAIPhotData() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x85BD65D: G4PAIPhotModel::~G4PAIPhotModel() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x85BD6F8: G4PAIPhotModel::~G4PAIPhotModel() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x862EA02: G4LossTableManager::~G4LossTableManager() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x86329C5:
G4ThreadLocalSingleton<G4LossTableManager>::Clear() (in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0x8632AB3:
G4ThreadLocalSingleton<G4LossTableManager>::~G4ThreadLocalSingleton()
(in
/afs/cern.ch/sw/lcg/external/geant4/10.0.p02/x86_64-slc6-gcc47-opt/lib64/libG4processes.so)
==11699== by 0xE9DCB31: exit (in /lib64/libc-2.12.so) ==11699== by
0xE9C5D63: (below main) (in /lib64/libc-2.12.so

[snip]

Following in the valgrind output are "Invalid write" and "Invalid free()
/ delete / delete[] / realloc()" at the same location.

Cheers

Dorothea
Comment 1 Vladimir.Ivantchenko 2014-09-22 12:50:30 CEST
Hello Dorothea,

thank you for the detailed description of the problem. It has been fixed in reference version of Geant4 10.0ref07 and will be available in the next public release. The fix was back-ported to 10.0p02 and will be available with the next patch to the version 10.0.

VI