RDataFrame with Friend Tree crashes when multithreading enabled

RDataFrame crashes when making a histogram if it has a friend and multithreading is enabled before declaring the RDataFrame.

Reproduce:

import ROOT
f = ROOT.TFile.Open('f.root')
t = f.Get('tree')
t.AddFriend('otree', 'ff.root')

ROOT.ROOT.EnableImplicitMT()
df = ROOT.RDataFrame(t)
h = df.Histo1D('branch_in_t')
h.Sumw2()

result:

 *** Break *** segmentation violation
...
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
<ipython-input-6-6684c9e62ba9> in <module>()
----> 1 h1.Sumw2()

SystemError: TH1D& ROOT::RDF::RResultPtr<TH1D>::operator*() =>
    problem in C++; program state has been reset

ROOT Version: 6.17/01
Platform: macOS
Compiler: Not Provided


PS: Examples that do not crash:
No multithreading:

import ROOT
f = ROOT.TFile.Open('f.root')
t = f.Get('tree')
t.AddFriend('otree', 'ff.root')

df = ROOT.RDataFrame(t)
h = df.Histo1D('branch_in_t')
h.Sumw2()

Multithreading after RDataFrame declaration:

import ROOT
f = ROOT.TFile.Open('f.root')
t = f.Get('tree')
t.AddFriend('otree', 'ff.root')

df = ROOT.RDataFrame(t)
ROOT.ROOT.EnableImplicitMT()
h = df.Histo1D('branch_in_t')
h.Sumw2()

No friend:

import ROOT
f = ROOT.TFile.Open('f.root')
t = f.Get('tree')

ROOT.ROOT.EnableImplicitMT()
df = ROOT.RDataFrame(t)
h = df.Histo1D('branch_in_t')
h.Sumw2()

Hi,

thanks for filing this one. It’s on our bug tracker.
Would it be possible to add there or here the two files which trigger the crash for completeness?

Cheers,
D

Hi,

I cannot reproduce this. Here the example in Python (I tried in C++ too without being able to crash the macro or the compiled program):

import ROOT
f = ROOT.TFile.Open('test_tdfandfriends.root')
t = f.Get('t')
t.AddFriend('t2', 'test_tdfandfriends2.root')

ROOT.ROOT.EnableImplicitMT()
df = ROOT.RDataFrame(t)
h = df.Histo1D('x')
h.Sumw2()
print(h.GetMean())

(input files can be found here https://cernbox.cern.ch/index.php/s/xO4VdXX0MIHy3kc)

Can you help me out providing more details? Meanwhile the jira issue is closed. We can re-open it anytime.

Cheers,
D

I’ve checked using your files, and indeed, they work just fine. There are a couple differences, such as my files being larger and storing multiple trees in subdirectories. I have sent you a private message with a link to the files I am using on CERNbox.

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

In case someone stumbles upon this topic. I can’t check the files anymore but I believe this was https://sft.its.cern.ch/jira/browse/ROOT-10152 (“Cannot analyze friend trees in subdirectories with MT”) which is now fixed in master (the fix will be available in v6.22/04 and v6.24).