*** Break *** segmentation violation in ROOT6.10.09

Hello Rooters,

I am using c++17 and ROOT6.10.09 in CMSSW_9_4_0. My code is successfully compiled but when I try to run my code, it crashes . The crash report is as below. Do you have any idea or experience on what causes this crash ? Thank you in advance.

++++++++++++++++++++++++
TreeUtilities : FillChain

No. of Entries in this tree : 181

I am running 0th entries out of 181 total entries

*** Break *** segmentation violation

===========================================================

There was a crash.

This is the entire stack trace of all threads:

===========================================================

#0 0x00007f8d5f6e646c in waitpid () from /lib64/libc.so.6

#1 0x00007f8d5f663f62 in do_system () from /lib64/libc.so.6

#2 0x00007f8d61501722 in TUnixSystem::StackTrace() () from /cvmfs/cms.cern.ch/slc7_amd64_gcc630/cms/cmssw/CMSSW_9_4_0/external/slc7_amd64_gcc630/lib/libCore.so

#3 0x00007f8d61503bcc in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc630/cms/cmssw/CMSSW_9_4_0/external/slc7_amd64_gcc630/lib/libCore.so

#4

#5 0x0000000000413ba5 in std::_Bit_reference::operator bool() const ()

#6 0x000000000040c0b6 in MyFourMuonAnalyzer::Loop(char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*) ()

#7 0x0000000000406cab in main ()

===========================================================

The lines below might hint at the cause of the crash.

You may get help by asking at the ROOT forum http://root.cern.ch/forum.

Only if you are really convinced it is a bug in ROOT then please submit a

report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace

from above as an attachment in addition to anything else

that might help us fixing this issue.

===========================================================

#5 0x0000000000413ba5 in std::_Bit_reference::operator bool() const ()

#6 0x000000000040c0b6 in MyFourMuonAnalyzer::Loop(char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*) ()

#7 0x0000000000406cab in main ()

===========================================================

Hi @gkarapin ,
and welcome to the ROOT forum!

The crash is in std::_Bit_reference::operator bool() const (), called from MyFourMuonAnalyzer::Loop(...): this is most likely your code (MyFourMuonAnalyzer) trying to access a non-existing element of a std::vector<bool> (the access is done through that _Bit_reference::operator bool()).

You can easily debug these kind of issues by compiling your code with debug symbols (-g compilation flag) and running the application within gdb (there are many tutorials around, e.g. this one).

Cheers,
Enrico

MyFourMuonAnalyzer.cc (55.4 KB) MyFourMuonAnalyzer.h (33.9 KB)

Hi @eguiraud,

Thank you :slight_smile:

I couldn’t use gdb, it seems that it doesn’t work for my input. (input1.txt" is not a core dump: File format not recognized) However, when I run with valgrind --track-origins=yes -v , I get the following error below. I am also adding here my code and the input I use in case you like to create the same error.

Cheers

FourMuon_2017_ntuple.root (1.2 MB)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
==10556== 1 errors in context 1 of 159:
==10556== Conditional jump or move depends on uninitialised value(s)
==10556== at 0x4C8A5DB: TList::Delete(char const*) (in /cvmfs/cms.cern.ch/slc7_amd64_gcc630/lcg/root/6.10.08/lib/libCore.so)
==10556== by 0x4B7249F: TROOT::~TROOT() (in /cvmfs/cms.cern.ch/slc7_amd64_gcc630/lcg/root/6.10.08/lib/libCore.so)
==10556== by 0x66B3CE8: __run_exit_handlers (in /usr/lib64/libc-2.17.so)
==10556== by 0x66B3D36: exit (in /usr/lib64/libc-2.17.so)
==10556== by 0x4D0489C: TUnixSystem::Exit(int, bool) (in /cvmfs/cms.cern.ch/slc7_amd64_gcc630/lcg/root/6.10.08/lib/libCore.so)
==10556== by 0x4D09CE5: TUnixSystem::DispatchSignals(ESignals) (in /cvmfs/cms.cern.ch/slc7_amd64_gcc630/lcg/root/6.10.08/lib/libCore.so)
==10556== by 0x646D62F: ??? (in /usr/lib64/libpthread-2.17.so)
==10556== by 0x413920: std::_Bit_reference::operator bool() const (stl_bvector.h:81)
==10556== by 0x40BE31: MyFourMuonAnalyzer::Loop(char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*, char const*) (MyFourMuonAnalyzer.cc:870)
==10556== by 0x406A26: main (MyFourMuonAnalyzer.cc:49)
==10556== Uninitialised value was created by a stack allocation
==10556== at 0x4C8A590: TList::Delete(char const*) (in /cvmfs/cms.cern.ch/slc7_amd64_gcc630/lcg/root/6.10.08/lib/libCore.so)

I couldn’t use gdb, it seems that it doesn’t work for my input. (input1.txt" is not a core dump: File format not recognized)

As per gdb --help, if you run gdb ./program input.txt, gdb interprets the second argument (input.txt) as a core dump file). You probably want instead gdb --args ./program input.txt.

Anyway, valgrind shows that the problematic access happens at MyFourMuonAnalyzer.cc:870, where you do access the contents of two vector<bool>s, MyMu1TrigMatchVtxSD and MyMu2TrigMatchVtxSD. You should check with gdb what element you are trying to access and figure out why it does not exist.

Good luck!
Enrico

@eguiraud it is solved. Thank you for pointing me!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.