Segmentation violation saving plots from a RDataFrame in multithreading with pyRoot

Hi everyone,
I’m having a problem creating a canvas and saving it as png with EnableImplictMT() on.
I’m running the script on Lxplus and I encountered the problem only with MT on. My code is as follows:

    num = dset.Filter(sel_num).Histo1D(bins, var)
    den = dset.Histo1D(bins, var)
#more code 

for var, (num, den) in effs.items():

    a = num.Clone()
    b = den.Clone()

    c = ROOT.TCanvas(f'c_eff_{var}', f'eff_{var}', 1600, 800)
    c.Divide(2, 1)
    eff = ROOT.TEfficiency(a, b)
    eff.SetNameTitle(f'eff_{var}', f'eff_{var};{var};efficiency')

I do a similar thing some line of codes before this ones and it works without problems. I tried without the canvas (saving them in a root file) and it works but I need to do the plots with this script. The error encountered is:

Info in TCanvas::Print>: file …/plots_new/c_eff_trk_pt.png has been created
Exception in thread Thread-1:
Traceback (most recent call last):
File “/cvmfs/”, line 973, in _bootstrap_inner
File “/cvmfs/”, line 910, in run
Info in TCanvas::Print>: file …/plots_new/c_eff_trk_eta.png has been created
self._target(*self._args, **self._kwargs)
File “/cvmfs/”, line 91, in _process_root_events
*** Break *** segmentation violation

I hope I was clear since it’s the first time writing in the forum. Thanks for all the help you could provide.

_ROOT Version: 6.26.04
_Platform: Lxplus
Compiler: Not Provided

Hello @gfalsett ,

and welcome to the ROOT forum!
Sorry about the trouble. Can you please provide a minimal, self-contained reproducer that we can run on LXPLUS to debug what’s going on? Your code looks ok at first glance and the error you get hints at something broken in the environment (which luckily we have access to, since it’s LXPLUS) rather than an issue with multi-threading.


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