RF Component segfaults at deletion
Issue #201
resolved
The RF component segfaults at the model deletion. In debug mode and gdb this is the stack trace (for the test component-RF
):
BDSRunAction::EndOfRunAction> Run Duration >> 0 s
main> BDSOutput deleting...
main> instances deleting...
BDSAcceleratorModel> Deleting model
BDSAcceleratorComponentRegistry::~BDSAcceleratorComponentRegistry> size of registry 1
Program received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 0x0000003348a89b58 in _wordcopy_fwd_aligned () from /lib64/libc.so.6
#1 0x0000003348a839c2 in memmove () from /lib64/libc.so.6
#2 0x00007ffff058f8a0 in std::vector<G4VPhysicalVolume*, std::allocator<G4VPhysicalVolume*> >::_M_erase(__gnu_cxx::__normal_iterator<G4VPhysicalVolume**, std::vector<G4VPhysicalVolume*, std::allocator<G4VPhysicalVolume*> > >) ()
at /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.2.0/include/c++/6.2.0/bits/stl_algobase.h:368
#3 0x00007ffff058f858 in G4PhysicalVolumeStore::DeRegister(G4VPhysicalVolume*) ()
at /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.2.0/include/c++/6.2.0/bits/stl_vector.h:1148
#4 0x00007ffff059c07c in G4VPhysicalVolume::~G4VPhysicalVolume() ()
at /home/scratch/geant4.10.02.p02/source/geometry/management/src/G4VPhysicalVolume.cc:123
#5 0x00007ffff06f71e9 in G4PVPlacement::~G4PVPlacement() ()
at /home/scratch/geant4.10.02.p02/source/geometry/volumes/src/G4PVPlacement.cc:162
#6 0x000000000093a19e in BDSGeometryComponent::~BDSGeometryComponent() ()
at /home/scratch/bdsim/src/BDSGeometryComponent.cc:51
#7 0x0000000000af8af6 in BDSCavity::~BDSCavity() () at /home/scratch/bdsim/include/BDSCavity.hh:30
#8 0x0000000000af8b12 in BDSCavity::~BDSCavity() () at /home/scratch/bdsim/include/BDSCavity.hh:30
#9 0x0000000000939fd8 in BDSGeometryComponent::~BDSGeometryComponent() ()
at /home/scratch/bdsim/src/BDSGeometryComponent.cc:42
#10 0x0000000000a2c8cf in BDSAcceleratorComponent::~BDSAcceleratorComponent() ()
at /home/scratch/bdsim/src/BDSAcceleratorComponent.cc:83
#11 0x0000000000ac510a in BDSCavityElement::~BDSCavityElement() ()
at /home/scratch/bdsim/src/BDSCavityElement.cc:25
#12 0x0000000000ac5126 in BDSCavityElement::~BDSCavityElement() ()
at /home/scratch/bdsim/src/BDSCavityElement.cc:26
#13 0x0000000000a2d2a7 in BDSAcceleratorComponentRegistry::~BDSAcceleratorComponentRegistry() ()
at /home/scratch/bdsim/src/BDSAcceleratorComponentRegistry.cc:28
#14 0x0000000000897269 in BDSAcceleratorModel::~BDSAcceleratorModel() ()
at /home/scratch/bdsim/src/BDSAcceleratorModel.cc:54
#15 0x0000000000895dc6 in main () at /home/scratch/bdsim/build-debug/bdsim.cc:286
Comments (7)
-
-
reporter This is the component-RF test. The cdash server sees this as well. What I have is Linux SLC6, Geant4 10.2.p2, gcc 6.2
-
I think I've fixed this in develop now - please can you try again.
-
reporter Still there I am afraid with same stack trace :-(
-
reporter I checked a bit and if I comment out line 41 in BDSCavityElement.cc (RegisterDaughter(cavity)) there is no segfault.
Could it be that this registration in connection with
BDSCavityFactoryBase::BuildCavityAndRegisterObjects()
occurs in a double delete perhaps? -
reporter Also in the rf.gmad file the segfault is only related to the rf5 cavity:
Boxy: cavitymodel, type="rectangular", irisRadius = 20*mm, equatorRadius = 10*cm, thickness = 3*mm, material = "Copper"; rf5: rf, l=10*cm, E=2*kV, frequency=1.2*GHz, cavityModel="Boxy";
-
reporter - changed status to resolved
fixed by Laurie and Jochem in commit 3941447
- Log in to comment
Please can you attach an example or way to reproduce - there are quite a few possible options now and I don't see this in my testing.
This would look like a nullptr for a G4VPhysicalVolume has been registered with BDSCavity (which is BDSGeometryComponent).