Segmentation violation with TProofOutputFile at merging

Hi everyone!

I’m trying use a tselector and proof (lite/root6.10.02) to process 3 diferents trees (merging), and save 2 output trees. I’ve checked that I’m reading the trees correctly including a simple histogram in tselector, and works ok. To save the output trees, I’ve followed the proof examples “ProofNTuple” and “ProofSimpleFile”.
The problem appears to be at fOutput->Add(fProofFile), because without that line it works (no output file is generated ofcourse). Here is part of the code:

void MergingSelector::SlaveBegin(TTree * tree)
{
   TString option = GetOption();
    fOutFileName="MergedFileOutput.root";
    fOutFileName = ReadStringOption(option,"OutputName=");
    
     fReaderbr.SetTree(dynamic_cast<TTree*>(fInput->FindObject("tbigrips")));
   fReaderwa.SetTree(dynamic_cast<TTree*>(fInput->FindObject("twasabi")));
   fReadereu.SetTree(dynamic_cast<TTree*>(fInput->FindObject("teurica")));
    
    Ion = new Ion_Pclass();
    Decay = new Decay_Pclass();
        
    fProofFile = new TProofOutputFile( "MergingFile.root",  TProofOutputFile::kMerge);
    fProofFile->SetOutputFileName((TString)("proof://paguilera@__lite__/"+Merge_RootFiles+fOutFileName));
    fProofFile->Print();
    //~ fProofFile->SetRetrieve(kTRUE);
    fFile = fProofFile->OpenFile("RECREATE");
    if (fFile && fFile->IsZombie()) SafeDelete(fFile);
    // Cannot continue
    if (!fFile) {
        Info("SlaveBegin", "could not create '%s': instance is invalid!", fProofFile->GetName());
        return;
    }
        
    tion = new TTree("tion", "new tion file");
    tion->SetDirectory(fFile);
    tion->AutoSave();
    tion->Branch("Ion",&Ion);
    tdecay = new TTree("tdecay", "new tdecay file");
    tdecay->SetDirectory(fFile);
    tdecay->AutoSave();
    tdecay->Branch("Decay",&Decay);
}

void MergingSelector::SlaveTerminate()
{
    Bool_t sometosave = kFALSE;
    TDirectory *savedir = gDirectory;
    if( tdecay && tdecay->GetEntries() > 0) {
        fFile->cd();
        tdecay->Write(0, TObject::kOverwrite);
        sometosave = kTRUE;
        if( tion && tion->GetEntries() > 0) {
            tion->Write(0, TObject::kOverwrite);
        }
        fProofFile->Print();
        fOutput->Add(fProofFile);
    }
    
    tdecay->SetDirectory(0);
    if (tion) tion->SetDirectory(0);
    gDirectory = savedir;
    fFile->Close();

   if (!sometosave) {
        TUrl uf(*(fFile->GetEndpointUrl()));
        SafeDelete(fFile);
        gSystem->Unlink(uf.GetFile());
        SafeDelete(fProofFile);
    }   
}

And I run the selector with a macro:

  {
...
        TProof* proof = TProofLite::Open("lite://","workers=2");
        TChain* chainbr;
	TChain* chainwa;
	TChain* chaineu;
...
       proof->AddInputData(chainbr);
	proof->AddInputData(chainwa);
	proof->AddInputData(chaineu);
...
      proof->Process("./MergingSelector.C+O",NEntries,options);
       proof->ClearInput();
	proof->ClearCache();
	proof->ClearInputData();
	proof->Close();
}

And the error:

+++ Starting PROOF-Lite with 2 workers +++
Opening connections to workers: OK (2 workers)                 
Setting up worker servers: OK (2 workers)                 
PROOF set to parallel mode (2 workers)
==== Info: Calling proof->Process.
 
Info in <TProofLite::SetQueryRunning>: starting query: 1
Info in <TProofQueryResult::SetRunning>: nwrks: 2
Info in <TUnixSystem::ACLiC>: creating shared library /home/paguilera/Trabajo/RIKEN/Convert/ClasesPAguilera/IonDecaySorting/v20_OnDevelopment/Mergev2/././MergingSelector_C.so
Lite-0: merging output objects ... \ (1 workers still sending)   
 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00002af260aba07a in __GI___waitpid (pid=19239, stat_loc=stat_loc
entry=0x7ffc60dc3080, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00002af260a32fbb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00002af26011af5d in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x18804f0) at /home/paguilera/Downloads/root-6.10.02/core/unix/src/TUnixSystem.cxx:2118
#3  TUnixSystem::StackTrace (this=0x18804f0) at /home/paguilera/Downloads/root-6.10.02/core/unix/src/TUnixSystem.cxx:2412
#4  0x00002af26011d54c in TUnixSystem::DispatchSignals (this=0x18804f0, sig=kSigSegmentationViolation) at /home/paguilera/Downloads/root-6.10.02/core/unix/src/TUnixSystem.cxx:3643
#5  <signal handler called>
#6  0x00002af2623181c1 in TStreamerInfo::AddReadAction (this=this
entry=0x3f01660, readSequence=0x3f01c60, i=i
entry=0, compinfo=0x5810938) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfoActions.cxx:2584
#7  0x00002af26231b331 in TStreamerInfo::Compile (this=0x3f01660) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfoActions.cxx:2461
#8  0x00002af26241bb2d in TStreamerInfo::BuildOld (this=<optimized out>) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfo.cxx:2506
#9  0x00002af2600e646c in TClass::GetStreamerInfo (this=this
entry=0x3d70cd0, version=6, version
entry=0) at /home/paguilera/Downloads/root-6.10.02/core/meta/src/TClass.cxx:4412
#10 0x00002af262409482 in TStreamerInfo::ForceWriteInfo (this=<optimized out>, file=0x53f3060, force=false) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfo.cxx:3111
#11 0x00002af2624093f9 in TStreamerInfo::ForceWriteInfo (this=<optimized out>, file=0x53f3060, force=false) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfo.cxx:3114
#12 0x00002af27ad907f9 in TTreeCloner::CopyStreamerInfos (this=this
entry=0x7ffc60dc5ff0) at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTreeCloner.cxx:508
#13 0x00002af27ad918f7 in TTreeCloner::Exec (this=this
entry=0x7ffc60dc5ff0) at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTreeCloner.cxx:201
#14 0x00002af27ad854e7 in TTree::CopyEntries (this=0x5526650, tree=0x561e630, nentries=<optimized out>, option=0x7ffc60dc63a1 " fast") at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTree.cxx:3442
#15 0x00002af27ad803e8 in TTree::CloneTree (this=0x561e630, nentries=-1, option=0x7ffc60dc63a1 " fast") at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTree.cxx:3146
#16 0x00002af27ad7a302 in TTree::Merge (this=0x561e630, li=0x7ffc60dc63c0, info=0x7ffc60dc6380) at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTree.cxx:6593
#17 0x00002af2622fe65b in TFileMerger::MergeRecursive (this=0x5625bb0, target=0x53f3060, sourcelist=0x56841f0, type=12) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TFileMerger.cxx:570
#18 0x00002af2622fd305 in TFileMerger::PartialMerge (this=0x5625bb0, in_type=12) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TFileMerger.cxx:842
#19 0x00002af27c9df288 in TProofPlayerRemote::MergeOutputFiles (this=this
entry=0x4258db0) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayer.cxx:2681
#20 0x00002af27c9e0aac in TProofPlayerRemote::MergeOutput (this=0x4258db0, saveMemValues=<optimized out>) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayer.cxx:3158
#21 0x00002af27ca12699 in TProofPlayerLite::Finalize (this=0x4258db0, force=<optimized out>, sync=<optimized out>) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayerLite.cxx:350
#22 0x00002af27ca1458b in TProofPlayerLite::Process (this=0x4258db0, dset=<optimized out>, selector_file=<optimized out>, option=<optimized out>, nentries=<optimized out>, first=0) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayerLite.cxx:312
#23 0x00002af27c6ebecb in TProofLite::Process (this=0x4009170, dset=0x433ea70, selector=0x2af27cee0f00 "./MergingSelector.C+O", option=<optimized out>, nentries=193362, first=0) at /home/paguilera/Downloads/root-6.10.02/proof/proof/src/TProofLite.cxx:1288
#24 0x00002af27c6a24db in TProof::Process (this=0x4009170, selector=0x2af27cee0f00 "./MergingSelector.C+O", n=193362, option=0x386a390 " OutputName=Merge_paguilera_v20_2003.root ") at /home/paguilera/Downloads/root-6.10.02/proof/proof/src/TProof.cxx:5708
#25 0x00002af27cedfe51 in RunProof(int) () from /home/paguilera/Trabajo/RIKEN/Convert/ClasesPAguilera/IonDecaySorting/v20_OnDevelopment/Mergev2/RunProof_Merging_C.so
#26 0x00002af25fa2f048 in ?? ()
#27 0x00002af25fa2f020 in ?? ()
#28 0x0000000003467010 in ?? ()
#29 0x00007ffc60dc7560 in ?? ()
#30 0x00002af262d27a17 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) [clone .part.253] [clone .constprop.361] () from /usr/local/root_v6.10.02/lib/libCling.so
#31 0x00002af262d2b14d 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 /usr/local/root_v6.10.02/lib/libCling.so
#32 0x00002af262d2b356 in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /usr/local/root_v6.10.02/lib/libCling.so
#33 0x00002af262dadf4f in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /usr/local/root_v6.10.02/lib/libCling.so
#34 0x00002af262cc3ea9 in HandleInterpreterException (metaProcessor=<optimized out>, input_line=<optimized out>, compRes=
0x7ffc60dc78b4: cling::Interpreter::kSuccess, result=result
entry=0x7ffc60dc78c0) at /home/paguilera/Downloads/root-6.10.02/core/metacling/src/TCling.cxx:1887
#35 0x00002af262cd4843 in TCling::ProcessLine (this=0x18daac0, line=<optimized out>, error=0x7ffc60dc7dcc) at /home/paguilera/Downloads/root-6.10.02/core/metacling/src/TCling.cxx:2050
#36 0x00002af2600415d0 in TApplication::ProcessLine (this=this
entry=0x18cb750, line=<optimized out>, sync=sync
entry=false, err=err
entry=0x7ffc60dc7dcc) at /home/paguilera/Downloads/root-6.10.02/core/base/src/TApplication.cxx:1001
#37 0x00002af25fc2962e in TRint::ProcessLineNr (this=this
entry=0x18cb750, filestem=filestem
entry=0x2af25fc2e76a "ROOT_prompt_", line=0x29b0750 "RunProof(2003)", error=0x7ffc60dc7dcc, error
entry=0x0) at /home/paguilera/Downloads/root-6.10.02/core/rint/src/TRint.cxx:741
#38 0x00002af25fc299b5 in TRint::HandleTermInput (this=0x18cb750) at /home/paguilera/Downloads/root-6.10.02/core/rint/src/TRint.cxx:602
#39 0x00002af26011ca3c in TUnixSystem::CheckDescriptors (this=this
entry=0x18804f0) at /home/paguilera/Downloads/root-6.10.02/core/unix/src/TUnixSystem.cxx:1321
#40 0x00002af26011de7a in TUnixSystem::DispatchOneEvent (this=0x18804f0, pendingOnly=<optimized out>) at /home/paguilera/Downloads/root-6.10.02/core/unix/src/TUnixSystem.cxx:1076
#41 0x00002af26001d244 in TSystem::InnerLoop (this=0x18804f0) at /home/paguilera/Downloads/root-6.10.02/core/base/src/TSystem.cxx:410
#42 0x00002af26001bd7f in TSystem::Run (this=0x18804f0) at /home/paguilera/Downloads/root-6.10.02/core/base/src/TSystem.cxx:360
#43 0x00002af26003e2df in TApplication::Run (this=this
entry=0x18cb750, retrn=retrn
entry=false) at /home/paguilera/Downloads/root-6.10.02/core/base/src/TApplication.cxx:1153
#44 0x00002af25fc2afa7 in TRint::Run (this=this
entry=0x18cb750, retrn=retrn
entry=false) at /home/paguilera/Downloads/root-6.10.02/core/rint/src/TRint.cxx:455
#45 0x0000000000400bbc in main (argc=1, argv=0x7ffc60dca238) at /home/paguilera/Downloads/root-6.10.02/main/src/rmain.cxx:30
===========================================================


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.
===========================================================
#6  0x00002af2623181c1 in TStreamerInfo::AddReadAction (this=this
entry=0x3f01660, readSequence=0x3f01c60, i=i
entry=0, compinfo=0x5810938) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfoActions.cxx:2584
#7  0x00002af26231b331 in TStreamerInfo::Compile (this=0x3f01660) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfoActions.cxx:2461
#8  0x00002af26241bb2d in TStreamerInfo::BuildOld (this=<optimized out>) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfo.cxx:2506
#9  0x00002af2600e646c in TClass::GetStreamerInfo (this=this
entry=0x3d70cd0, version=6, version
entry=0) at /home/paguilera/Downloads/root-6.10.02/core/meta/src/TClass.cxx:4412
#10 0x00002af262409482 in TStreamerInfo::ForceWriteInfo (this=<optimized out>, file=0x53f3060, force=false) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfo.cxx:3111
#11 0x00002af2624093f9 in TStreamerInfo::ForceWriteInfo (this=<optimized out>, file=0x53f3060, force=false) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TStreamerInfo.cxx:3114
#12 0x00002af27ad907f9 in TTreeCloner::CopyStreamerInfos (this=this
entry=0x7ffc60dc5ff0) at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTreeCloner.cxx:508
#13 0x00002af27ad918f7 in TTreeCloner::Exec (this=this
entry=0x7ffc60dc5ff0) at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTreeCloner.cxx:201
#14 0x00002af27ad854e7 in TTree::CopyEntries (this=0x5526650, tree=0x561e630, nentries=<optimized out>, option=0x7ffc60dc63a1 " fast") at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTree.cxx:3442
#15 0x00002af27ad803e8 in TTree::CloneTree (this=0x561e630, nentries=-1, option=0x7ffc60dc63a1 " fast") at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTree.cxx:3146
#16 0x00002af27ad7a302 in TTree::Merge (this=0x561e630, li=0x7ffc60dc63c0, info=0x7ffc60dc6380) at /home/paguilera/Downloads/root-6.10.02/tree/tree/src/TTree.cxx:6593
#17 0x00002af2622fe65b in TFileMerger::MergeRecursive (this=0x5625bb0, target=0x53f3060, sourcelist=0x56841f0, type=12) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TFileMerger.cxx:570
#18 0x00002af2622fd305 in TFileMerger::PartialMerge (this=0x5625bb0, in_type=12) at /home/paguilera/Downloads/root-6.10.02/io/io/src/TFileMerger.cxx:842
#19 0x00002af27c9df288 in TProofPlayerRemote::MergeOutputFiles (this=this
entry=0x4258db0) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayer.cxx:2681
#20 0x00002af27c9e0aac in TProofPlayerRemote::MergeOutput (this=0x4258db0, saveMemValues=<optimized out>) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayer.cxx:3158
#21 0x00002af27ca12699 in TProofPlayerLite::Finalize (this=0x4258db0, force=<optimized out>, sync=<optimized out>) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayerLite.cxx:350
#22 0x00002af27ca1458b in TProofPlayerLite::Process (this=0x4258db0, dset=<optimized out>, selector_file=<optimized out>, option=<optimized out>, nentries=<optimized out>, first=0) at /home/paguilera/Downloads/root-6.10.02/proof/proofplayer/src/TProofPlayerLite.cxx:312
#23 0x00002af27c6ebecb in TProofLite::Process (this=0x4009170, dset=0x433ea70, selector=0x2af27cee0f00 "./MergingSelector.C+O", option=<optimized out>, nentries=193362, first=0) at /home/paguilera/Downloads/root-6.10.02/proof/proof/src/TProofLite.cxx:1288
#24 0x00002af27c6a24db in TProof::Process (this=0x4009170, selector=0x2af27cee0f00 "./MergingSelector.C+O", n=193362, option=0x386a390 " OutputName=Merge_paguilera_v20_2003.root ") at /home/paguilera/Downloads/root-6.10.02/proof/proof/src/TProof.cxx:5708
#25 0x00002af27cedfe51 in RunProof(int) () from /home/paguilera/Trabajo/RIKEN/Convert/ClasesPAguilera/IonDecaySorting/v20_OnDevelopment/Mergev2/RunProof_Merging_C.so
#26 0x00002af25fa2f048 in ?? ()
#27 0x00002af25fa2f020 in ?? ()
#28 0x0000000003467010 in ?? ()
#29 0x00007ffc60dc7560 in ?? ()
#30 0x00002af262d27a17 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) [clone .part.253] [clone .constprop.361] () from /usr/local/root_v6.10.02/lib/libCling.so
#31 0x00002af262d2b14d 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 /usr/local/root_v6.10.02/lib/libCling.so
#32 0x00002af262d2b356 in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /usr/local/root_v6.10.02/lib/libCling.so
#33 0x00002af262dadf4f in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /usr/local/root_v6.10.02/lib/libCling.so
#34 0x00002af262cc3ea9 in HandleInterpreterException (metaProcessor=<optimized out>, input_line=<optimized out>, compRes=
0x7ffc60dc78b4: cling::Interpreter::kSuccess, result=result
entry=0x7ffc60dc78c0) at /home/paguilera/Downloads/root-6.10.02/core/metacling/src/TCling.cxx:1887
===========================================================

Maybe is a dummy error but I cannot see it.

Thanks in advance!

1 Like

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