ComPWA / ComPWA-legacy

[deprecated] C++ back-end for the Common Partial Wave Analysis framework
https://compwa.github.io/legacy
Other
9 stars 9 forks source link

segfault from shared_ptrs in ParameterList #235

Closed redeboer closed 5 years ago

redeboer commented 5 years ago

A segmentation fault is caused by shared_ptrs in ParameterList. This happened the moment when ParameterList is destroyed.

To Reproduce I was rewriting the DalitzFit example to use an XML file from the expert system as input instead of a stringstream. The bug was introduced when switching from DalitzPlot to RootPlotData:

ComPWA::Tools::Plotting::RootPlotData plot(kin.getParticleStateTransitionKinematicsInfo(), "rootplot.root");
  plot.writeData(SampleDataSet);
  plot.writeIntensityWeightedPhspSample(Data::convertEventsToDataSet(phspSample, kin), intens);

gdb backtraceq

Thread 1 "JpsiToGammaPi0P" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../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:51
#1  0x00007ffff479f801 in __GI_abort () at abort.c:79
#2  0x00007ffff47e8897 in __libc_message (action=action@entry=do_abort, 
    fmt=fmt@entry=0x7ffff4915b9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff47ef90a in malloc_printerr (
    str=str@entry=0x7ffff49177a8 "munmap_chunk(): invalid pointer") at malloc.c:5350
#4  0x00007ffff47f6ecc in munmap_chunk (p=0x5555569ffbd0) at malloc.c:2846
#5  __GI___libc_free (mem=0x5555569ffbe0) at malloc.c:3117
#6  0x00007ffff79a8189 in ComPWA::FunctionTree::Value<std::vector<double, std::allocator<double> > >::~Value() ()
   from /home/remco/pycompwa/ComPWA/build/Estimator/MinLogLH/libComPWA_MinLogLH.so
#7  0x0000555555568dea in ComPWA::FunctionTree::ParameterList::~ParameterList() ()
#8  0x000055555556a350 in ComPWA::Physics::IntensityBuilderXML::~IntensityBuilderXML() ()
#9  0x000055555556492a in main ()

Environment (please complete the following information):

redeboer commented 5 years ago

You can reproduce the error from this branch on my fork.

It happens when you run the JpsiToGammaPi0Pi0 script with Examples/JpsiToGammaPi0Pi0/model.xml as input.

redeboer commented 5 years ago

Fixed by pull request #244