Dear experts,
The post is a bit long, since the issue is somewhat convoluted.
I’m having a very weird issue when trying to clone a TTree and modify its content before saving it. The full application is crashing when when I do TTree::Fill()
on the clone tree with the following stack trace
The lines below might hint at the cause of the crash. If you see question
marks as part of the stack trace, try to recompile with debugging information
enabled and export CLING_DEBUG=1 environment variable before running.
You may get help by asking at the ROOT forum https://root.cern/forum
preferably using the command (.forum bug) in the ROOT prompt.
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/bugs or (preferably) using the command (.gh bug) in
the ROOT prompt. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x00007f5519351c75 in int TStreamerInfo::WriteBufferAux<char**>(TBuffer&, char** const&, TStreamerInfo::TCompInfo* const*, int, int, int, int, int) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libRIO.so
#6 0x00007f55191dcbfc in TStreamerInfoActions::VectorLooper::GenericWrite(TBuffer&, void*, void const*, TStreamerInfoActions::TLoopConfiguration const*, TStreamerInfoActions::TConfiguration const*) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libRIO.so
#7 0x00007f55190cbe34 in TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*, void*) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libRIO.so
#8 0x00007f551852d12e in TBranchElement::FillLeavesCollectionMember(TBuffer&) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libTree.so
#9 0x00007f5518524a26 in TBranch::FillImpl(ROOT::Internal::TBranchIMTHelper*) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libTree.so
#10 0x00007f551852ec2d in TBranchElement::FillImpl(ROOT::Internal::TBranchIMTHelper*) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libTree.so
#11 0x00007f551852e977 in TBranchElement::FillImpl(ROOT::Internal::TBranchIMTHelper*) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libTree.so
#12 0x00007f551852e977 in TBranchElement::FillImpl(ROOT::Internal::TBranchIMTHelper*) () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libTree.so
#13 0x00007f55185a4757 in TTree::Fill() () from /cvmfs/sft.cern.ch/lcg/views/LCG_106b/x86_64-el9-gcc13-opt/lib/libTree.so
#14 0x00000000004da26b in NA62Reconstruction::ProcessEventWrapper (this=0x3010ce0, iData=..., currMap=...) at /home/stefan/NA62/MC_Validation/na62fw/NA62Reconstruction/src/NA62Reconstruction.cc:1010
#15 0x00000000004d9cc9 in NA62Reconstruction::NextEvent (this=0x3010ce0) at /home/stefan/NA62/MC_Validation/na62fw/NA62Reconstruction/src/NA62Reconstruction.cc:913
#16 0x000000000045c084 in main (argc=12, argv=0x7fffa2696188) at /home/stefan/NA62/MC_Validation/na62fw/NA62Reconstruction/NA62Reco.cc:199
===========================================================
Out application is huge so I tried composing a MWE, which is attached. However, it does not crash. Still, I noticed something very odd. When reading a cloned tree, sometimes the ClassName()
method of some of the read objects is wrong. I’m posting this here as maybe it helps elucidating the issue also of the crash.
The MWE has 2 parts. In the first part, a tree with 6 branches is created. The branches are made from different classes AEvent1...AEvent6
, each holding a std::vector<Double_t>
. In the second part, this tree is read via TChain
, cloned, modified at each entry and finally written to another file. Instructions to run the MWE (cling) and reproduce the class name issue.
$ root -l
root [0] .L clone_mwe.cc
root [1] do_stuff() // this creates a TTree called ttree
root [2] copytree3()
The last command above outputs in my case
Writting 0/100
AEvent1 AEvent2 AEvent3 AEvent4 AEvent5 AEvent6
AEvent1 AEvent2 AEvent3 AEvent1 AEvent5 AEvent6
...
Notice how after the first event the name of the 4th class is different. Of course, I cannot be sure this issue causes also the crash. However, in my application, the crash occurs always in an event where the names are wrong.
clone_mwe.cc (7.0 KB)
Any help on this would be greatly appreciated.
Regards,
Stefan,
NA62 software coordinator
Please fill also the fields below. Note that root -b -q
will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug
from the ROOT prompt to pre-populate a topic.
ROOT Version: 6.32.08 and 6.26.08
Platform: Almalinux 9 and Ubuntu 24.04
Compiler: gcc