I have a piece of code which works perfectly under ROOT 5.34.18. However, under newer versions (I tried 25, 26 and 30), it segfaults when it tries to read a tree after calling MakeProject. I don’t have any versions between 18 and 25 to test on, but I can build them if necessary to debug this.
It’s designed to loop over a tree of classes. If there’s already a library generated, it’s fine. Otherwise, it calls MakeProject, and then when it tries to actually read the tree later, you get a segfault.
The MakeProject call looks like this:
followed by:
Full stacktrace:
[code]MakeProject has generated 41 classes in libReadoaAnalysis_v11r31
libReadoaAnalysis_v11r31/MAKEP file has been generated
Shared lib libReadoaAnalysis_v11r31/libReadoaAnalysis_v11r31.so has been generated
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
Thread 2 (Thread 0x7feb98e49700 (LWP 5701)):
#0 sem_wait () at …/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1 0x00000000005519f0 in ?? ()
#2 0x000000000052c6d5 in PyEval_EvalFrameEx ()
#3 0x000000000056d0aa in ?? ()
#4 0x000000000052e1e6 in PyEval_EvalFrameEx ()
#5 0x000000000052cf32 in PyEval_EvalFrameEx ()
#6 0x000000000052cf32 in PyEval_EvalFrameEx ()
#7 0x000000000056d0aa in ?? ()
#8 0x00000000004d9854 in ?? ()
#9 0x00000000004da20b in PyEval_CallObjectWithKeywords ()
#10 0x00000000005872b2 in ?? ()
#11 0x00007febae2ff182 in start_thread (arg=0x7feb98e49700) at pthread_create.c:312
#12 0x00007febae02c47d in clone () at …/sysdeps/unix/sysv/linux/x86_64/clone.S:111
Thread 1 (Thread 0x7febae709740 (LWP 5682)):
#0 0x00007febadff2b99 in __libc_waitpid (pid=5720, stat_loc=stat_loc
entry=0x7ffe272be340, options=options
entry=0) at …/sysdeps/unix/sysv/linux/waitpid.c:40
#1 0x00007febadf782e2 in do_system (line=) at …/sysdeps/posix/system.c:148
#2 0x00007febabe465c3 in TUnixSystem::StackTrace() () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#3 0x00007febabe482cc in TUnixSystem::DispatchSignals(ESignals) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#4
#5 0x00007febaae1fbc4 in TGenCollectionProxy::InitializeEx(bool) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#6 0x00007febaae23a8b in TGenCollectionStreamer::ReadBufferDefault(TBuffer&, void*, TClass const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#7 0x00007febaadf53f3 in TBufferFile::ReadFastArray(void*, TClass const*, int, TMemberStreamer*, TClass const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#8 0x00007febaae95364 in int TStreamerInfoActions::ReadSTL<&TStreamerInfoActions::ReadSTLMemberWiseSameClass, &TStreamerInfoActions::ReadSTLObjectWiseFastArray>(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#9 0x00007febaadf4aa5 in TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#10 0x00007febaa991231 in TBranchElement::ReadLeavesMember(TBuffer&) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#11 0x00007febaa98c70c in TBranch::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#12 0x00007febaa99fc78 in TBranchElement::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#13 0x00007febaa99fd14 in TBranchElement::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#14 0x00007febaa9dde91 in TTree::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#15 0x00007febaaa0efec in G__G__Tree_131_0_84(G__value*, char const*, G__param*, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#16 0x00007febab2df33b in Cint::G__CallFunc::Execute(void*) () from /home/steve/packages/root/v5_34_30/lib/libCint.so.5.34
#17 0x00007febac5c348e in PyROOT::TIntExecutor::Execute(Cint::G__CallFunc*, void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#18 0x00007febac5c9620 in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::CallSafe(void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#19 0x00007febac5c9792 in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::Execute(void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#20 0x00007febac5c8bdb in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::operator()(PyROOT::ObjectProxy*, _object*, _object*, long, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#21 0x00007febac5cd37d in PyROOT::(anonymous namespace)::mp_call(PyROOT::MethodProxy*, _object*, _object*) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#22 0x000000000052cc20 in PyEval_EvalFrameEx ()
#23 0x000000000056cd2a in ?? ()
#24 0x00000000004cd87a in ?? ()
#25 0x000000000052c6d5 in PyEval_EvalFrameEx ()
#26 0x000000000052cf32 in PyEval_EvalFrameEx ()
#27 0x000000000052cf32 in PyEval_EvalFrameEx ()
#28 0x000000000055c594 in PyEval_EvalCodeEx ()
#29 0x00000000005b7392 in PyEval_EvalCode ()
#30 0x0000000000469663 in ?? ()
#31 0x00000000004699e3 in PyRun_FileExFlags ()
#32 0x0000000000469f1c in PyRun_SimpleFileExFlags ()
#33 0x000000000046ab81 in Py_Main ()
#34 0x00007febadf53ec5 in __libc_start_main (main=0x46ac3f , argc=3, argv=0x7ffe272c19e8, init=, fini=, rtld_fini=, stack_end=0x7ffe272c19d8) at libc-start.c:287
#35 0x000000000057497e in _start ()
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug 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 0x00007febaae1fbc4 in TGenCollectionProxy::InitializeEx(bool) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#6 0x00007febaae23a8b in TGenCollectionStreamer::ReadBufferDefault(TBuffer&, void*, TClass const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#7 0x00007febaadf53f3 in TBufferFile::ReadFastArray(void*, TClass const*, int, TMemberStreamer*, TClass const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#8 0x00007febaae95364 in int TStreamerInfoActions::ReadSTL<&TStreamerInfoActions::ReadSTLMemberWiseSameClass, &TStreamerInfoActions::ReadSTLObjectWiseFastArray>(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#9 0x00007febaadf4aa5 in TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#10 0x00007febaa991231 in TBranchElement::ReadLeavesMember(TBuffer&) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#11 0x00007febaa98c70c in TBranch::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#12 0x00007febaa99fc78 in TBranchElement::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#13 0x00007febaa99fd14 in TBranchElement::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
#14 0x00007febaa9dde91 in TTree::GetEntry(long long, int) () from /home/steve/packages/root/v5_34_30/lib/libTree.so.5.34
Traceback (most recent call last):
File “./barrel_ecal_alignment_selection.py”, line 471, in
main()
File “./barrel_ecal_alignment_selection.py”, line 466, in main
align.EventLoop()
File “./barrel_ecal_alignment_selection.py”, line 158, in EventLoop
geomtree = next(chainIters[“HeaderDir/GeometrySummary”])
File “/home/steve/packages/root/v5_34_30/lib/ROOT.py”, line 265, in TTree__iter_
bytes_read = self.GetEntry(i)
SystemError: problem in C++; program state has been reset
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
#0 0x00007febadff2b99 in __libc_waitpid (pid=5845, stat_loc=stat_loc
entry=0x7ffe272be600, options=options
entry=0) at …/sysdeps/unix/sysv/linux/waitpid.c:40
#1 0x00007febadf782e2 in do_system (line=) at …/sysdeps/posix/system.c:148
#2 0x00007febabe465c3 in TUnixSystem::StackTrace() () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#3 0x00007febabe482cc in TUnixSystem::DispatchSignals(ESignals) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#4
#5 0x00007febaae17a2c in TFile::WriteStreamerInfo() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#6 0x00007febaae17040 in TFile::Close(char const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#7 0x00007febabdb2c10 in (anonymous namespace)::R__ListSlowClose(TList*) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#8 0x00007febabdb351d in TROOT::CloseFiles() () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#9 0x00007febabdb3970 in TROOT::EndOfProcessCleanups(bool) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#10 0x00007febac00687d in G__G__Base2_346_0_14(G__value*, char const*, G__param*, int) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#11 0x00007febab2df33b in Cint::G__CallFunc::Execute(void*) () from /home/steve/packages/root/v5_34_30/lib/libCint.so.5.34
#12 0x00007febac5c2646 in PyROOT::TVoidExecutor::Execute(Cint::G__CallFunc*, void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#13 0x00007febac5c9620 in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::CallSafe(void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#14 0x00007febac5c9792 in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::Execute(void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#15 0x00007febac5c8bdb in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::operator()(PyROOT::ObjectProxy*, _object*, _object*, long, bool) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#16 0x00007febac5cd37d in PyROOT::(anonymous namespace)::mp_call(PyROOT::MethodProxy*, _object*, _object*) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#17 0x000000000052cc20 in PyEval_EvalFrameEx ()
#18 0x000000000056d0aa in ?? ()
#19 0x000000000052e1e6 in PyEval_EvalFrameEx ()
#20 0x000000000056d0aa in ?? ()
#21 0x00000000004da29f in PyEval_CallObjectWithKeywords ()
#22 0x000000000042fa19 in Py_Finalize ()
#23 0x000000000046ac10 in Py_Main ()
#24 0x00007febadf53ec5 in __libc_start_main (main=0x46ac3f , argc=3, argv=0x7ffe272c19e8, init=, fini=, rtld_fini=, stack_end=0x7ffe272c19d8) at libc-start.c:287
#25 0x000000000057497e in _start ()
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug 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 0x00007febaae17a2c in TFile::WriteStreamerInfo() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#6 0x00007febaae17040 in TFile::Close(char const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#7 0x00007febabdb2c10 in (anonymous namespace)::R__ListSlowClose(TList*) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#8 0x00007febabdb351d in TROOT::CloseFiles() () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#9 0x00007febabdb3970 in TROOT::EndOfProcessCleanups(bool) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File “/usr/lib/python2.7/atexit.py”, line 24, in _run_exitfuncs
func(*targs, **kargs)
File “/home/steve/packages/root/v5_34_30/lib/ROOT.py”, line 654, in cleanup
gROOT.EndOfProcessCleanups(True)
SystemError: problem in C++; program state has been reset
Error in sys.exitfunc:
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
#0 0x00007febadff2b99 in __libc_waitpid (pid=5904, stat_loc=stat_loc
entry=0x7ffe272beac0, options=options
entry=0) at …/sysdeps/unix/sysv/linux/waitpid.c:40
#1 0x00007febadf782e2 in do_system (line=) at …/sysdeps/posix/system.c:148
#2 0x00007febabe465c3 in TUnixSystem::StackTrace() () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#3 0x00007febabe482cc in TUnixSystem::DispatchSignals(ESignals) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#4
#5 0x00007febaae17a2c in TFile::WriteStreamerInfo() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#6 0x00007febaae17040 in TFile::Close(char const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#7 0x00007febaae17167 in TFile::~TFile() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#8 0x00007febaae17449 in TFile::~TFile() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#9 0x00007febaaf6e0b4 in ROOTDict::delete_TFile(void*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#10 0x00007febabe183c6 in TClass::Destructor(void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#11 0x00007febac5cfabb in PyROOT::op_dealloc_nofree(PyROOT::ObjectProxy*) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#12 0x00007febac5cfaf9 in PyROOT::(anonymous namespace)::op_dealloc(PyROOT::ObjectProxy*) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#13 0x00000000004d94bb in ?? ()
#14 0x00000000005392ff in ?? ()
#15 0x0000000000497382 in ?? ()
#16 0x000000000053a517 in ?? ()
#17 0x0000000000534323 in ?? ()
#18 0x00000000005342f9 in ?? ()
#19 0x00000000004f0d4c in PySys_SetObject ()
#20 0x000000000042ec9a in PyErr_PrintEx ()
#21 0x000000000042fa42 in Py_Finalize ()
#22 0x000000000046ac10 in Py_Main ()
#23 0x00007febadf53ec5 in __libc_start_main (main=0x46ac3f , argc=3, argv=0x7ffe272c19e8, init=, fini=, rtld_fini=, stack_end=0x7ffe272c19d8) at libc-start.c:287
#24 0x000000000057497e in _start ()
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug 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 0x00007febaae17a2c in TFile::WriteStreamerInfo() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#6 0x00007febaae17040 in TFile::Close(char const*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#7 0x00007febaae17167 in TFile::~TFile() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#8 0x00007febaae17449 in TFile::~TFile() () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#9 0x00007febaaf6e0b4 in ROOTDict::delete_TFile(void*) () from /home/steve/packages/root/v5_34_30/lib/libRIO.so.5.34
#10 0x00007febabe183c6 in TClass::Destructor(void*, bool) () from /home/steve/packages/root/v5_34_30/lib/libCore.so.5.34
#11 0x00007febac5cfabb in PyROOT::op_dealloc_nofree(PyROOT::ObjectProxy*) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#12 0x00007febac5cfaf9 in PyROOT::(anonymous namespace)::op_dealloc(PyROOT::ObjectProxy*) () from /home/steve/packages/root/v5_34_30/lib/libPyROOT.so
#13 0x00000000004d94bb in ?? ()
#14 0x00000000005392ff in ?? ()
#15 0x0000000000497382 in ?? ()
#16 0x000000000053a517 in ?? ()
#17 0x0000000000534323 in ?? ()
#18 0x00000000005342f9 in ?? ()
#19 0x00000000004f0d4c in PySys_SetObject ()
#20 0x000000000042ec9a in PyErr_PrintEx ()
#21 0x000000000042fa42 in Py_Finalize ()
#22 0x000000000046ac10 in Py_Main ()
#23 0x00007febadf53ec5 in __libc_start_main (main=0x46ac3f , argc=3, argv=0x7ffe272c19e8, init=, fini=, rtld_fini=, stack_end=0x7ffe272c19d8) at libc-start.c:287
#24 0x000000000057497e in _start ()
[/code]