segfault in SamplerAnalysis

Issue #205 resolved
Jochem Snuverink created an issue

The IO_ROOTEVENT-rebdsim test fails with the following segfault (http://jaiserv1.pp.rhul.ac.uk/cdash/testDetails.php?test=151366&build=1385) :

rebdsim> configuration file name : analysisConfig.txt
Config::Instance> No instance present, construct
Loading> ./output_event.root
Analysis on "Event." beginning
Event #     0 of 3Event #     1 of 3Event #     2 of 3Sampler analysis complete                           

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x0000003c314ac82e in waitpid () from /lib64/libc.so.6
#1  0x0000003c3143e479 in do_system () from /lib64/libc.so.6
#2  0x00007fa38759a84a in TUnixSystem::StackTrace() () at /zfs_home/accsoft/SL68/build/ROOT/v6.08.02/GCC-4.9.3-Python-2.7.12/root-6.08.02/core/unix/src/TUnixSystem.cxx:2116
#3  0x00007fa38759cf7c in TUnixSystem::DispatchSignals(ESignals) () at /zfs_home/accsoft/SL68/build/ROOT/v6.08.02/GCC-4.9.3-Python-2.7.12/root-6.08.02/core/unix/src/TUnixSystem.cxx:3661
#4  <signal handler called>
#5  0x00007fa387b9554e in SamplerAnalysis::powSumToCentralMoment(std::vector<std::vector<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, std::allocator<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > > >, std::allocator<std::vector<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, std::allocator<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > > > > >&, long long, int, int, int, int) () from /nfs/scratch3/lnevay/cdash-builds/SLC68-GCC-Geant4.10.3.p01-R6-develop/analysis/librebdsimLib.so
#6  0x00007fa387b967f2 in SamplerAnalysis::Terminate(std::vector<double, std::allocator<double> >, bool) () from /nfs/scratch3/lnevay/cdash-builds/SLC68-GCC-Geant4.10.3.p01-R6-develop/analysis/librebdsimLib.so
#7  0x00007fa387ba539c in EventAnalysis::Terminate() () from /nfs/scratch3/lnevay/cdash-builds/SLC68-GCC-Geant4.10.3.p01-R6-develop/analysis/librebdsimLib.so
#8  0x00007fa387ba6dc3 in Analysis::Execute() () from /nfs/scratch3/lnevay/cdash-builds/SLC68-GCC-Geant4.10.3.p01-R6-develop/analysis/librebdsimLib.so
#9  0x0000000000403039 in main ()
===========================================================

Comments (3)

  1. Jochem Snuverink reporter

    Some more debug info from gdb:

    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff7dbdce1 in SamplerAnalysis::powSumToCentralMoment(std::vector<std::vector<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, std::allocator<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > > >, std::allocator<std::vector<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, std::allocator<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > > > > >&, long long, int, int, int, int) ()
        at /home/scratch/bdsim/analysis/SamplerAnalysis.cc:335
    335       moment = s_1_0/npartIn+o[k];
    Missing separate debuginfos, use: debuginfo-install expat-2.0.1-13.el6_8.x86_64 freetype-2.3.11-15.el6_6.1.x86_64 glibc-2.12-1.209.el6_9.2.x86_64 keyutils-libs-1.4-4.el6.x86_64 krb5-libs-1.10.3-42z1.el6_7.x86_64 libICE-1.0.6-1.el6.x86_64 libSM-1.2.1-2.el6.x86_64 libX11-1.6.4-3.el6.x86_64 libXau-1.0.6-4.el6.x86_64 libXdamage-1.1.3-4.el6.x86_64 libXext-1.3.2-2.1.el6.x86_64 libXfixes-5.0.3-1.el6.x86_64 libXxf86vm-1.1.3-2.1.el6.x86_64 libcom_err-1.41.12-14.el6_4.4.x86_64 libdrm-2.4.65-2.el6.x86_64 libselinux-2.0.94-5.3.el6_4.1.x86_64 libuuid-2.17.2-12.9.el6_4.3.x86_64 libxcb-1.12-4.el6.x86_64 mesa-dri-drivers-11.0.7-4.el6.x86_64 mesa-libGL-11.0.7-4.el6.x86_64 mesa-libGLU-11.0.7-4.el6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64 nss-pam-ldapd-0.7.5-20.el6_6.3.x86_64 nss-softokn-freebl-3.14.3-23.el6_7.x86_64 openssl-1.0.1e-48.sl6_8.4.x86_64 xz-libs-4.999.9-0.3.beta.20091007git.el6.x86_64 zlib-1.2.3-29.el6.x86_64
    (gdb) bt
    #0  0x00007ffff7dbdce1 in SamplerAnalysis::powSumToCentralMoment(std::vector<std::vector<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, std::allocator<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > > >, std::allocator<std::vector<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, std::allocator<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > > > > >&, long long, int, int, int, int) ()
        at /home/scratch/bdsim/analysis/SamplerAnalysis.cc:335
    #1  0x00007ffff7dbefd9 in SamplerAnalysis::Terminate(std::vector<double, std::allocator<double> >, bool) ()
        at /home/scratch/bdsim/analysis/SamplerAnalysis.cc:173
    #2  0x00007ffff7db2823 in EventAnalysis::Terminate() () at /home/scratch/bdsim/analysis/EventAnalysis.cc:134
    #3  0x00007ffff7d8e873 in Analysis::Execute() () at /home/scratch/bdsim/analysis/Analysis.cc:33
    #4  0x0000000000402d99 in main () at /home/scratch/bdsim/analysis/rebdsim.cc:89
    (gdb) line
    330   if((m == 1 && n == 0) || (m == 0 && n == 1))
    331     {
    332       double s_1_0 = powSums[a][b][m][n];
    333         int k = m>n ? a : b;
    334 
    335       moment = s_1_0/npartIn+o[k];
    336     }
    337 
    338   else if((n == 2 && m == 0) || (n == 0 && m == 2))
    339     {
    
  2. Laurie Nevay

    @andreyabramov and I had been working on this yesterday as we saw it on the test server. We had trouble reproducing it directly even on the same platform, which is why it wasn't solved yet.

    I had a look at the code this morning and there was a shadow variable declared in the constructor. This led to an empty vector being used later. The continuous testing shows this as passing now so I'm closing this issue.

    As the behaviour can sometimes be compiler dependent, I've removed the compiler flag to ignore shadow warnings and indeed there were quite a few warnings throughout the code. I've now fixed these.

    I also removed the non-virtual destructor warning as that has largely been fixed a few months ago.

    These changes should keep us safer in future.

  3. Jochem Snuverink reporter

    Okay great!

    By the way the name is confusing, but the compiler flag -Wnon-virtual-dtor is not a "negative" flag.

  4. Log in to comment