Segfault after Terminate

Hello,

I’ve started to try to use PROOF-lite on my laptop (Macbook Pro dual core running Mountain Lion), using ROOT 5.34/02. I have a TSelector (called JpsiSelector) which works perfectly when run without PROOF. The input file contains a single TTree called JPSI.

I then tried to run it in PROOF as follows:

TProof::Open("");
TFile* file = TFile::Open(“jpsiZ2012.root”);
TChain* ch = new TChain(“JPSI”, “Jpsi Chain”);
ch->AddFile(“jpsiZ2012.root”);
ch->SetProof();
ch->Process(“JpsiSelector.C+”);

Then the following appears, along with a nice graphical dialogue box giving the progress and performance:

Info in TProofLite::SetQueryRunning: starting query: 1
Info in TProofQueryResult::SetRunning: nwrks: 2
Looking up for exact location of files: OK (1 files)
Looking up for exact location of files: OK (1 files)
Info in TPacketizerAdaptive::TPacketizerAdaptive: Setting max number of workers per node to 2
Validating files: OK (1 files)
Info in TPacketizerAdaptive::InitStats: fraction of remote files 1.000000

Then it finishes, and I guess it tries to merge the output from the two cores…

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:

Thread 1 (process 7330):
#0 0x00007fff96c4b6ac in wait4 ()
#1 0x00007fff8e7ad03a in system ()
#2 0x000000010360479f in TUnixSystem::StackTrace ()
#3 0x00000001036025e7 in TUnixSystem::DispatchSignals ()
#4
#5 0x0000000106d8854a in JpsiSelector::Terminate ()
#6 0x0000000105a85419 in TProofPlayerLite::Finalize ()
#7 0x0000000105a850d8 in TProofPlayerLite::Process ()
#8 0x0000000104ff2237 in TProofLite::Process ()
#9 0x0000000104e52416 in G__G__Tree_126_0_156 ()
#10 0x0000000103e0df9f in Cint::G__ExceptionWrapper ()
#11 0x0000000103ebdb3a in G__execute_call ()
#12 0x0000000103ebe11b in G__call_cppfunc ()
#13 0x0000000103e92603 in G__interpret_func ()
#14 0x0000000103e7ba40 in G__getfunction ()
#15 0x0000000103f7df20 in G__getstructmem ()
#16 0x0000000103f7478a in G__getvariable ()
#17 0x0000000103e708b2 in G__getitem ()
#18 0x0000000103e6fac6 in G__getexpr ()
#19 0x0000000103eefcac in G__exec_statement ()
#20 0x0000000103e52248 in G__exec_tempfile_core ()
#21 0x0000000103e51e06 in G__exec_tempfile_fp ()
#22 0x0000000103efb9ba in G__process_cmd ()
#23 0x00000001035ca4d8 in TCint::ProcessLine ()
#24 0x00000001035344d5 in TApplication::ProcessLine ()
#25 0x0000000104539caa in TRint::HandleTermInput ()
#26 0x0000000104538367 in TTermInputHandler::Notify ()
#27 0x000000010453a51d in TTermInputHandler::ReadNotify ()
#28 0x0000000103601ab6 in TUnixSystem::CheckDescriptors ()
#29 0x0000000103601301 in TUnixSystem::DispatchOneEvent ()
#30 0x000000010358b5aa in TSystem::InnerLoop ()
#31 0x000000010358b3dd in TSystem::Run ()
#32 0x0000000103534e54 in TApplication::Run ()
#33 0x0000000104539660 in TRint::Run ()
#34 0x0000000103526a5f in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
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 0x0000000106d8854a in JpsiSelector::Terminate ()
#6 0x0000000105a85419 in TProofPlayerLite::Finalize ()
#7 0x0000000105a850d8 in TProofPlayerLite::Process ()
#8 0x0000000104ff2237 in TProofLite::Process ()

I attach my JpsiSelector code so that you can see exactly what it’s doing - having checked some other discussions on this forum it seems that similar crashes occur if one tries to delete certain objects in the Terminate() method, but I don’t do anything like that:

void JpsiSelector::Terminate()
{
// The Terminate() function is the last function to be called during
// a query. It always runs on the client, it can be used to present
// the results graphically or save the results to file.
TFile resultfile(“results.root”, “RECREATE”);
fHist->Write();
resultfile.Close();
}

Anyhow, if you have any ideas about what I might be doing wrong, please let me know. Just to stress again, the TSelector works if run in standard ROOT.

Thanks in advance and best wishes,

James Catmore (ATLAS)
JpsiSelector.h (7.15 KB)
JpsiSelector.C (3.46 KB)

Dear James,

The crash must happen at 
    fHist->Write()
Can you try by initialising 'fHist' to 0 in the JpsiSelector constructor? (where you initialize fChain to 0).

Since you are using 5.34/02  you can also try to use the 'of=outfile' option to save your results (with an empty Terminate):
    ch->Process("JpsiSelector.C+", "of=results.root"); 
See [root.cern.ch/drupal/content/handling-outputs](http://root.cern.ch/drupal/content/handling-outputs) .

Let me know.

G. Ganis