cmstas / NanoTools

tools, usage examples for CMS nanoAOD
1 stars 16 forks source link

perfstats causing segfaults? #4

Open aminnj opened 3 years ago

aminnj commented 3 years ago

Apparently this line causes segafults when a looper opens up the Nth file (N random but > 1) of a TChain

https://github.com/cmstas/NanoTools/blob/9a391ad815ee71cce063262824ee26fd35c46eba/cpp/ScanChain_ss.C#L70

suggest to remove it to avoid issues where people copy this as a template and run into a super annoying problem. It's not used for anything later in the script.

For reference, a stack trace I got:

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f271f7bc46c in waitpid () from /usr/lib64/libc.so.6
#1  0x00007f271f739f62 in do_system () from /usr/lib64/libc.so.6
#2  0x00007f27202fba8b in TUnixSystem::StackTrace() () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCore.so
#3  0x00007f27202fe0cc in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCore.so
#4  <signal handler called>
#5  0x00007f2711b17dd8 in TTreePerfStats::FileReadEvent(TFile*, int, double) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libTreePlayer.so
#6  0x00007f271ec5df23 in TFile::ReadBuffer(char*, int) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libRIO.so
#7  0x00007f271ec64b21 in TFile::Init(bool) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libRIO.so
#8  0x00007f271ec65e51 in TFile::TFile(char const*, char const*, char const*, int) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libRIO.so
#9  0x00007f271ec6995d in TFile::Open(char const*, char const*, char const*, int, int) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libRIO.so
#10 0x00007f270dcfbaf6 in ScanChain(TChain*) () from /home/users/namin/sandbox/forFrank/NanoTools/cpp/ScanChain_ss_C.so
#11 0x00007f271b95a041 in ?? ()
#12 0x0000000000fef1a8 in ?? ()
#13 0x00007f271c20c771 in cling::MultiplexInterpreterCallbacks::EnteringUserCode() () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCling.so
#14 0x00007ffc108b16c0 in ?? ()
#15 0x00007f271b95a000 in ?? ()
#16 0x00007f271c2101d2 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) [clone .part.248] () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCling.so
#17 0x00007f271c2128b9 in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCling.so
#18 0x00007f271c212b02 in cling::Interpreter::Evaluate(char const*, clang::DeclContext*, bool) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCling.so
#19 0x00007f271c212b70 in cling::runtime::internal::EvaluateDynamicExpression(cling::Interpreter*, cling::runtime::internal::DynamicExprInfo*, clang::DeclContext*) () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCling.so
#20 0x00007f27141b6139 in ?? ()
#21 0x00007ffc108b22c0 in ?? ()
#22 0x00007f271fabe760 in ?? () from /usr/lib64/libc.so.6
#23 0x00007ffc108b16c0 in ?? ()
#24 0x00007f271c212b20 in ?? () from /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/lib/libCling.so
#25 0x0000000007cf5ff0 in ?? ()
#26 0x0000000000000000 in ?? ()
===========================================================

I guess TTreePerfStats hooks into TFile::Open and does bad things

aminnj commented 3 years ago

Indeed. The last response to this thread (from 11 years ago!) says that TTreePerfStats only works on a single file.

aminnj commented 3 years ago

Fixed by https://github.com/cmstas/NanoTools/commit/8206bce62e1d632b5ca833e4e2334098e5ee74f1 but leaving the issue open for now for discoverability