**Break** Segmentation Violation in Reading Delphes Output

ROOT Version: 6.32.08
Platform: Linux
Compiler: Python 3.8

Dear Experts,

I am trying to read Delphes output with PyROOT. I attempted Danilo’s solution in this post, but got the segmentation violation. The weird thing is I can correctly access information about my jets for the first event without a problem, i.e. the system will first print out the information about the first event, then go into this segmentation error. Can someone help me look at it?

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fbb14ad8b3f in __GI___wait4 (pid=107054, stat_loc=stat_loc
entry=0x7ffc5de80e38, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007fbb14ad8abb in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffc5de80e38, options=options
entry=0) at waitpid.c:38
#2  0x00007fbb14a4b283 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:171
#3  0x00007fbb146432ce in TUnixSystem::StackTrace() () from /home/yichaoc/root/lib/libCore.so
#4  0x00007fbb147f2083 in (anonymous namespace)::TExceptionHandlerImp::HandleException(int) () from /home/yichaoc/root/lib/libcppyy_backend.so
#5  0x00007fbb14640861 in TUnixSystem::DispatchSignals(ESignals) () from /home/yichaoc/root/lib/libCore.so
#6  <signal handler called>
#7  0x00007fbaf7545e9a in TBranchElement::ReadLeavesClones(TBuffer&) () from /home/yichaoc/root/lib/libTree.so
#8  0x00007fbaf753d899 in TBranch::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#9  0x00007fbaf755026b in TBranchElement::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#10 0x00007fbaf75b4420 in TTree::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#11 0x00007fbaed68703d in ?? ()
#12 0x000056012606b500 in ?? ()
#13 0x00007ffc5de83a90 in ?? ()
#14 0x0000000125e51a00 in ?? ()
#15 0x00007ffc5de83ae0 in ?? ()
#16 0x00007ffc5de83b1c in ?? ()
#17 0x00007fbb152cf531 in _dl_lookup_symbol_x (undef_name=0x7ffc5de83b1c "", undef_map=0x560125e51690, undef_map
entry=0x7ffc5de83d80, ref=0x7ffc5de83a70, ref
entry=0x7ffc5de83b80, symbol_scope=<optimized out>, version=0x0, type_class=1575501184, type_class
entry=1, flags=5, skip_map=0x0) at dl-lookup.c:872
#18 0x00007fbb152d5c22 in _dl_fixup (l=0x7ffc5de83d80, reloc_arg=1378) at dl-runtime.c:95
#19 0x00007fbaf76b2a25 in CPyCppyy::(anonymous namespace)::LLongConverter::SetArg(_object*, CPyCppyy::Parameter&, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#20 0x000056012606b500 in ?? ()
#21 0x00005601267d13e0 in ?? ()
#22 0x00007ffc5de83d80 in ?? ()
#23 0x00007ffc5de83d18 in ?? ()
#24 0x00007ffc5de83c30 in ?? ()
#25 0x0000000000000015 in ?? ()
#26 0x00007fbaf76eb379 in CPyCppyy::CPPMethod::Execute(void*, long, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#27 0x00007fbaf76ebb42 in CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object* const*, unsigned long, _object*, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#28 0x00007fbaf76f1e21 in CPyCppyy::(anonymous namespace)::mp_vectorcall(CPyCppyy::CPPOverload*, _object* const*, unsigned long, _object*) () from /home/yichaoc/root/lib/libcppyy.so
#29 0x00007fbb14f354d7 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#30 0x00007fbb14f56b68 in gen_send_ex () from /lib64/libpython3.9.so.1.0
#31 0x00007fbb14f306f9 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#32 0x00007fbb14f2ecd9 in _PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#33 0x00007fbb14f2e945 in _PyEval_EvalCodeWithName () from /lib64/libpython3.9.so.1.0
#34 0x00007fbb14fe3a77 in PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#35 0x00007fbb150114c4 in run_eval_code_obj () from /lib64/libpython3.9.so.1.0
#36 0x00007fbb1500d5bb in run_mod () from /lib64/libpython3.9.so.1.0
#37 0x00007fbb14e97ba2 in pyrun_file.cold () from /lib64/libpython3.9.so.1.0
#38 0x00007fbb15006e09 in PyRun_SimpleFileExFlags () from /lib64/libpython3.9.so.1.0
#39 0x00007fbb150042bf in Py_RunMain () from /lib64/libpython3.9.so.1.0
#40 0x00007fbb14fd64ed in Py_BytesMain () from /lib64/libpython3.9.so.1.0
#41 0x00007fbb14a295d0 in __libc_start_call_main (main=main
entry=0x56011eba8160 <main>, argc=argc
entry=2, argv=argv
entry=0x7ffc5de84698) at ../sysdeps/nptl/libc_start_call_main.h:58
#42 0x00007fbb14a29680 in __libc_start_main_impl (main=0x56011eba8160 <main>, argc=2, argv=0x7ffc5de84698, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc5de84688) at ../csu/libc-start.c:389
#43 0x000056011eba8095 in _start ()
===========================================================


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.
===========================================================
#7  0x00007fbaf7545e9a in TBranchElement::ReadLeavesClones(TBuffer&) () from /home/yichaoc/root/lib/libTree.so
#8  0x00007fbaf753d899 in TBranch::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#9  0x00007fbaf755026b in TBranchElement::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#10 0x00007fbaf75b4420 in TTree::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#11 0x00007fbaed68703d in ?? ()
#12 0x000056012606b500 in ?? ()
#13 0x00007ffc5de83a90 in ?? ()
#14 0x0000000125e51a00 in ?? ()
#15 0x00007ffc5de83ae0 in ?? ()
#16 0x00007ffc5de83b1c in ?? ()
#17 0x00007fbb152cf531 in _dl_lookup_symbol_x (undef_name=0x7ffc5de83b1c "", undef_map=0x560125e51690, undef_map
entry=0x7ffc5de83d80, ref=0x7ffc5de83a70, ref
entry=0x7ffc5de83b80, symbol_scope=<optimized out>, version=0x0, type_class=1575501184, type_class
entry=1, flags=5, skip_map=0x0) at dl-lookup.c:872
#18 0x00007fbb152d5c22 in _dl_fixup (l=0x7ffc5de83d80, reloc_arg=1378) at dl-runtime.c:95
#19 0x00007fbaf76b2a25 in CPyCppyy::(anonymous namespace)::LLongConverter::SetArg(_object*, CPyCppyy::Parameter&, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#20 0x000056012606b500 in ?? ()
#21 0x00005601267d13e0 in ?? ()
#22 0x00007ffc5de83d80 in ?? ()
#23 0x00007ffc5de83d18 in ?? ()
#24 0x00007ffc5de83c30 in ?? ()
#25 0x0000000000000015 in ?? ()
#26 0x00007fbaf76eb379 in CPyCppyy::CPPMethod::Execute(void*, long, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#27 0x00007fbaf76ebb42 in CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object* const*, unsigned long, _object*, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#28 0x00007fbaf76f1e21 in CPyCppyy::(anonymous namespace)::mp_vectorcall(CPyCppyy::CPPOverload*, _object* const*, unsigned long, _object*) () from /home/yichaoc/root/lib/libcppyy.so
#29 0x00007fbb14f354d7 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#30 0x00007fbb14f56b68 in gen_send_ex () from /lib64/libpython3.9.so.1.0
#31 0x00007fbb14f306f9 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#32 0x00007fbb14f2ecd9 in _PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#33 0x00007fbb14f2e945 in _PyEval_EvalCodeWithName () from /lib64/libpython3.9.so.1.0
#34 0x00007fbb14fe3a77 in PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#35 0x00007fbb150114c4 in run_eval_code_obj () from /lib64/libpython3.9.so.1.0
#36 0x00007fbb1500d5bb in run_mod () from /lib64/libpython3.9.so.1.0
#37 0x00007fbb14e97ba2 in pyrun_file.cold () from /lib64/libpython3.9.so.1.0
#38 0x00007fbb15006e09 in PyRun_SimpleFileExFlags () from /lib64/libpython3.9.so.1.0
#39 0x00007fbb150042bf in Py_RunMain () from /lib64/libpython3.9.so.1.0
#40 0x00007fbb14fd64ed in Py_BytesMain () from /lib64/libpython3.9.so.1.0
#41 0x00007fbb14a295d0 in __libc_start_call_main (main=main
entry=0x56011eba8160 <main>, argc=argc
entry=2, argv=argv
entry=0x7ffc5de84698) at ../sysdeps/nptl/libc_start_call_main.h:58
#42 0x00007fbb14a29680 in __libc_start_main_impl (main=0x56011eba8160 <main>, argc=2, argv=0x7ffc5de84698, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc5de84688) at ../csu/libc-start.c:389
#43 0x000056011eba8095 in _start ()
===========================================================


 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fbb14ad8b3f in __GI___wait4 (pid=107698, stat_loc=stat_loc
entry=0x7ffc5de80e38, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007fbb14ad8abb in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffc5de80e38, options=options
entry=0) at waitpid.c:38
#2  0x00007fbb14a4b283 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:171
#3  0x00007fbb146432ce in TUnixSystem::StackTrace() () from /home/yichaoc/root/lib/libCore.so
#4  0x00007fbb147f1f03 in (anonymous namespace)::TExceptionHandlerImp::HandleException(int) () from /home/yichaoc/root/lib/libcppyy_backend.so
#5  0x00007fbb14640861 in TUnixSystem::DispatchSignals(ESignals) () from /home/yichaoc/root/lib/libCore.so
#6  <signal handler called>
#7  0x00007fbaf7545e9a in TBranchElement::ReadLeavesClones(TBuffer&) () from /home/yichaoc/root/lib/libTree.so
#8  0x00007fbaf753d899 in TBranch::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#9  0x00007fbaf755026b in TBranchElement::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#10 0x00007fbaf75b4420 in TTree::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#11 0x00007fbaed68703d in ?? ()
#12 0x000056012606b500 in ?? ()
#13 0x00007ffc5de83a90 in ?? ()
#14 0x0000000125e51a00 in ?? ()
#15 0x00007ffc5de83ae0 in ?? ()
#16 0x00007ffc5de83b1c in ?? ()
#17 0x00007fbb152cf531 in _dl_lookup_symbol_x (undef_name=0x7ffc5de83b1c "", undef_map=0x560125e51690, undef_map
entry=0x7ffc5de83d80, ref=0x7ffc5de83a70, ref
entry=0x7ffc5de83b80, symbol_scope=<optimized out>, version=0x0, type_class=1575501184, type_class
entry=1, flags=5, skip_map=0x0) at dl-lookup.c:872
#18 0x00007fbb152d5c22 in _dl_fixup (l=0x7ffc5de83d80, reloc_arg=1378) at dl-runtime.c:95
#19 0x00007fbaf76b2a25 in CPyCppyy::(anonymous namespace)::LLongConverter::SetArg(_object*, CPyCppyy::Parameter&, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#20 0x000056012606b500 in ?? ()
#21 0x00005601267d13e0 in ?? ()
#22 0x00007ffc5de83d80 in ?? ()
#23 0x00007ffc5de83d18 in ?? ()
#24 0x00007ffc5de83c30 in ?? ()
#25 0x0000000000000015 in ?? ()
#26 0x00007fbaf76eb379 in CPyCppyy::CPPMethod::Execute(void*, long, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#27 0x00007fbaf76ebb42 in CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object* const*, unsigned long, _object*, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#28 0x00007fbaf76f1e21 in CPyCppyy::(anonymous namespace)::mp_vectorcall(CPyCppyy::CPPOverload*, _object* const*, unsigned long, _object*) () from /home/yichaoc/root/lib/libcppyy.so
#29 0x00007fbb14f354d7 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#30 0x00007fbb14f56b68 in gen_send_ex () from /lib64/libpython3.9.so.1.0
#31 0x00007fbb14f306f9 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#32 0x00007fbb14f2ecd9 in _PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#33 0x00007fbb14f2e945 in _PyEval_EvalCodeWithName () from /lib64/libpython3.9.so.1.0
#34 0x00007fbb14fe3a77 in PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#35 0x00007fbb150114c4 in run_eval_code_obj () from /lib64/libpython3.9.so.1.0
#36 0x00007fbb1500d5bb in run_mod () from /lib64/libpython3.9.so.1.0
#37 0x00007fbb14e97ba2 in pyrun_file.cold () from /lib64/libpython3.9.so.1.0
#38 0x00007fbb15006e09 in PyRun_SimpleFileExFlags () from /lib64/libpython3.9.so.1.0
#39 0x00007fbb150042bf in Py_RunMain () from /lib64/libpython3.9.so.1.0
#40 0x00007fbb14fd64ed in Py_BytesMain () from /lib64/libpython3.9.so.1.0
#41 0x00007fbb14a295d0 in __libc_start_call_main (main=main
entry=0x56011eba8160 <main>, argc=argc
entry=2, argv=argv
entry=0x7ffc5de84698) at ../sysdeps/nptl/libc_start_call_main.h:58
#42 0x00007fbb14a29680 in __libc_start_main_impl (main=0x56011eba8160 <main>, argc=2, argv=0x7ffc5de84698, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc5de84688) at ../csu/libc-start.c:389
#43 0x000056011eba8095 in _start ()
===========================================================


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.
===========================================================
#7  0x00007fbaf7545e9a in TBranchElement::ReadLeavesClones(TBuffer&) () from /home/yichaoc/root/lib/libTree.so
#8  0x00007fbaf753d899 in TBranch::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#9  0x00007fbaf755026b in TBranchElement::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#10 0x00007fbaf75b4420 in TTree::GetEntry(long long, int) () from /home/yichaoc/root/lib/libTree.so
#11 0x00007fbaed68703d in ?? ()
#12 0x000056012606b500 in ?? ()
#13 0x00007ffc5de83a90 in ?? ()
#14 0x0000000125e51a00 in ?? ()
#15 0x00007ffc5de83ae0 in ?? ()
#16 0x00007ffc5de83b1c in ?? ()
#17 0x00007fbb152cf531 in _dl_lookup_symbol_x (undef_name=0x7ffc5de83b1c "", undef_map=0x560125e51690, undef_map
entry=0x7ffc5de83d80, ref=0x7ffc5de83a70, ref
entry=0x7ffc5de83b80, symbol_scope=<optimized out>, version=0x0, type_class=1575501184, type_class
entry=1, flags=5, skip_map=0x0) at dl-lookup.c:872
#18 0x00007fbb152d5c22 in _dl_fixup (l=0x7ffc5de83d80, reloc_arg=1378) at dl-runtime.c:95
#19 0x00007fbaf76b2a25 in CPyCppyy::(anonymous namespace)::LLongConverter::SetArg(_object*, CPyCppyy::Parameter&, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#20 0x000056012606b500 in ?? ()
#21 0x00005601267d13e0 in ?? ()
#22 0x00007ffc5de83d80 in ?? ()
#23 0x00007ffc5de83d18 in ?? ()
#24 0x00007ffc5de83c30 in ?? ()
#25 0x0000000000000015 in ?? ()
#26 0x00007fbaf76eb379 in CPyCppyy::CPPMethod::Execute(void*, long, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#27 0x00007fbaf76ebb42 in CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object* const*, unsigned long, _object*, CPyCppyy::CallContext*) () from /home/yichaoc/root/lib/libcppyy.so
#28 0x00007fbaf76f1e21 in CPyCppyy::(anonymous namespace)::mp_vectorcall(CPyCppyy::CPPOverload*, _object* const*, unsigned long, _object*) () from /home/yichaoc/root/lib/libcppyy.so
#29 0x00007fbb14f354d7 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#30 0x00007fbb14f56b68 in gen_send_ex () from /lib64/libpython3.9.so.1.0
#31 0x00007fbb14f306f9 in _PyEval_EvalFrameDefault () from /lib64/libpython3.9.so.1.0
#32 0x00007fbb14f2ecd9 in _PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#33 0x00007fbb14f2e945 in _PyEval_EvalCodeWithName () from /lib64/libpython3.9.so.1.0
#34 0x00007fbb14fe3a77 in PyEval_EvalCode () from /lib64/libpython3.9.so.1.0
#35 0x00007fbb150114c4 in run_eval_code_obj () from /lib64/libpython3.9.so.1.0
#36 0x00007fbb1500d5bb in run_mod () from /lib64/libpython3.9.so.1.0
#37 0x00007fbb14e97ba2 in pyrun_file.cold () from /lib64/libpython3.9.so.1.0
#38 0x00007fbb15006e09 in PyRun_SimpleFileExFlags () from /lib64/libpython3.9.so.1.0
#39 0x00007fbb150042bf in Py_RunMain () from /lib64/libpython3.9.so.1.0
#40 0x00007fbb14fd64ed in Py_BytesMain () from /lib64/libpython3.9.so.1.0
#41 0x00007fbb14a295d0 in __libc_start_call_main (main=main
entry=0x56011eba8160 <main>, argc=argc
entry=2, argv=argv
entry=0x7ffc5de84698) at ../sysdeps/nptl/libc_start_call_main.h:58
#42 0x00007fbb14a29680 in __libc_start_main_impl (main=0x56011eba8160 <main>, argc=2, argv=0x7ffc5de84698, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc5de84688) at ../csu/libc-start.c:389
#43 0x000056011eba8095 in _start ()
===========================================================


Segmentation fault (core dumped)

Edit: The error occurs exactly on the line event.Jet, or any other event.Stuff.

Try running the failing example with valgrind --suppressions=$ROOTSYS/etc/valgrind-root.supp --suppressions=$ROOTSYS/etc/valgrind-root-python.supp ... to get a better understanding of where things go wrong.

Seems similar to: Pyroot crashes reading TClonesArray in a TTree · Issue #16725 · root-project/root · GitHub

Thank you @pcanal. Here is the output of valgrind:

==3997== Memcheck, a memory error detector
==3997== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3997== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==3997== Command: python3 ./MadLAD/readROOT.py
==3997== 
==3997== Invalid read of size 8
==3997==    at 0x40286A8: strncmp (strcmp.S:172)
==3997==    by 0x400668D: is_dst (dl-load.c:216)
==3997==    by 0x400810E: _dl_dst_count (dl-load.c:253)
==3997==    by 0x400810E: expand_dynamic_string_token (dl-load.c:395)
==3997==    by 0x40082B7: fillin_rpath.isra.0 (dl-load.c:483)
==3997==    by 0x4008602: decompose_rpath (dl-load.c:654)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:696)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:677)
==3997==    by 0x400A8C8: _dl_map_object (dl-load.c:2117)
==3997==    by 0x4003494: openaux (dl-deps.c:64)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==3997==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==3997==  Address 0x54aefb1 is 17 bytes inside a block of size 23 alloc'd
==3997==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==3997==    by 0x40271DF: malloc (rtld-malloc.h:56)
==3997==    by 0x40271DF: strdup (strdup.c:42)
==3997==    by 0x4008594: decompose_rpath (dl-load.c:629)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:696)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:677)
==3997==    by 0x400A8C8: _dl_map_object (dl-load.c:2117)
==3997==    by 0x4003494: openaux (dl-deps.c:64)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==3997==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x400E34D: _dl_open (dl-open.c:883)
==3997== 
==3997== Invalid read of size 8
==3997==    at 0x40286A8: strncmp (strcmp.S:172)
==3997==    by 0x400668D: is_dst (dl-load.c:216)
==3997==    by 0x4007F79: _dl_dst_substitute (dl-load.c:295)
==3997==    by 0x40082B7: fillin_rpath.isra.0 (dl-load.c:483)
==3997==    by 0x4008602: decompose_rpath (dl-load.c:654)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:696)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:677)
==3997==    by 0x400A8C8: _dl_map_object (dl-load.c:2117)
==3997==    by 0x4003494: openaux (dl-deps.c:64)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==3997==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==3997==  Address 0x54aefb1 is 17 bytes inside a block of size 23 alloc'd
==3997==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==3997==    by 0x40271DF: malloc (rtld-malloc.h:56)
==3997==    by 0x40271DF: strdup (strdup.c:42)
==3997==    by 0x4008594: decompose_rpath (dl-load.c:629)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:696)
==3997==    by 0x400A8C8: cache_rpath (dl-load.c:677)
==3997==    by 0x400A8C8: _dl_map_object (dl-load.c:2117)
==3997==    by 0x4003494: openaux (dl-deps.c:64)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==3997==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==3997==    by 0x4B09A97: _dl_catch_exception (dl-error-skeleton.c:208)
==3997==    by 0x400E34D: _dl_open (dl-open.c:883)
==3997== 

==3997== Invalid read of size 8
==3997==    at 0x27FB58: ??? (in /usr/bin/python3.10)
==3997==    by 0x234D24: ??? (in /usr/bin/python3.10)
==3997==    by 0x233919: ??? (in /usr/bin/python3.10)
==3997==    by 0x33BB4F: ??? (in /usr/bin/python3.10)
==3997==    by 0x25A2A7: ??? (in /usr/bin/python3.10)
==3997==    by 0x261B62: ??? (in /usr/bin/python3.10)
==3997==    by 0x25C77A: ??? (in /usr/bin/python3.10)
==3997==    by 0x26AEA132: CPyCppyy::CreateScopeProxy(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, _object*, unsigned int) (in /home/alexcai/root/lib/libcppyy.so)
==3997==    by 0x26AEA603: CPyCppyy::CreateScopeProxy(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, _object*, unsigned int) (in /home/alexcai/root/lib/libcppyy.so)
==3997==    by 0x26AEA603: CPyCppyy::CreateScopeProxy(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, _object*, unsigned int) (in /home/alexcai/root/lib/libcppyy.so)
==3997==    by 0x26AEAE84: CPyCppyy::CreateScopeProxy(unsigned long, unsigned int) (in /home/alexcai/root/lib/libcppyy.so)
==3997==    by 0x26AEAEE5: CPyCppyy::BindCppObjectNoCast(void*, unsigned long, unsigned int) (in /home/alexcai/root/lib/libcppyy.so)
==3997==  Address 0x9 is not stack'd, malloc'd or (recently) free'd
==3997== 
 *** Break *** segmentation violation
#0  0x00000000580e3dc0 in ?? ()
#1  0x000000005809d35d in ?? ()
#2  0x0000000058098c13 in ?? ()
#3  0x000000005809acf8 in ?? ()
#4  0x00000000580e3f41 in ?? ()
#5  0x0000000000000000 in ?? ()
 *** Break *** segmentation violation
#0  0x00000000580e3dc0 in ?? ()
#1  0x000000005809d35d in ?? ()
#2  0x0000000058098c13 in ?? ()
#3  0x000000005809acf8 in ?? ()
#4  0x00000000580e3f41 in ?? ()
#5  0x0000000000000000 in ?? ()
==3997== 
==3997== HEAP SUMMARY:
==3997==     in use at exit: 67,830,625 bytes in 49,018 blocks
==3997==   total heap usage: 260,720 allocs, 211,702 frees, 629,176,293 bytes allocated
==3997== 
==3997== LEAK SUMMARY:
==3997==    definitely lost: 3,368 bytes in 31 blocks
==3997==    indirectly lost: 0 bytes in 0 blocks
==3997==      possibly lost: 8,280 bytes in 14 blocks
==3997==    still reachable: 67,629,437 bytes in 45,812 blocks
==3997==                       of which reachable via heuristic:
==3997==                         multipleinheritance: 320 bytes in 1 blocks
==3997==         suppressed: 189,540 bytes in 3,161 blocks
==3997== Rerun with --leak-check=full to see details of leaked memory
==3997== 
==3997== For lists of detected and suppressed errors, rerun with: -s
==3997== ERROR SUMMARY: 5 errors from 3 contexts (suppressed: 88 from 27)

Hi, All. I am still stuck on this issue with Python. I know I can turn to C++, which I tried and it works, but I have a lot of previous work in python, so it is still greatly appreciated if someone can help me on this issue.

@vpadulan The valgrind is odd as the errors “seem” internal to python. It may (or may not) be that inconsistent libraries (for example coming from 2 distincts release of ROOT and Delphes) are being loaded in the same process. One way to check that is to run the failing example under gdb and look at the output of info shared on the gdb prompt

You can try Pyroot crashes reading TClonesArray in a TTree · Issue #16725 · root-project/root · GitHub as python workaround

Hi @ferhue. The work around looks like a way to only create a histogram using RDataFrame.Define(). However I do not want histogram, I need to analyze the data one by one in the root file (and hopefully put them all into some other format like HepMC). Can this work around be modified in a certain way to help me do that? Let’s say I just want now print out the 4 momentum of all particles in an event.

Maybe @vpadulan knows