Segfault when Booking a DataSet with RDataFrame (on MAC, no issue on Linux)

Hello all,

I moved to a MAC recently and one of the scripts is complaining. I am running root 6.28 in a conda env. I used tuple in the constructor, I see some suggestions to use a list but it still crashes (not on linux).

Snippet:

  
    w = ROOT.RooWorkspace("w", "workspace")

    # MeV LcDst fit variable
    varrangeMeV    = (-50, 50)
    xlabelMeV      = ROOTLcDst_M + "-" + ROOTLcDst_M + " _{TRUE} [MeV]"
    fitvar = ROOT.RooRealVar("m_LcDst", xlabelMeV, *varrangeMeV)

    # w.Import(data_fitted)
    w.Import(fitvar)

    weightskinematic = ROOT.RooRealVar(
        "weights_kinematic", "weights_kinematic", -10, 10)

    # Read the data
    for hyp in ["pi0", "gamma"]:

        df = ROOT.RDataFrame(args.tree, args.inputfile).Filter(
            f"Dst_ECC{hyp}_M>0")

        # Define truth mass combinations
        df = add_truth_dalitz_columns(df)
        df = add_fullreco_dalitz_columns(df)

        # Define resolution variables for MeV and GeV2 
        df = df.Define(f"LcDst_M_res{hyp}",       f"(LcDst_ECC{hyp}_M  - LcDst_TRUE_M)")
        df = df.Define(f"LcDst_M2_GeV2_res{hyp}", f"(LcDst_ECC{hyp}_M2 - LcDst_TRUE_M2)/1e6")

        # Correct the BF in LcDstK MC
        if "LcDstK" in args.inputfile:
            weight = "bfweight"
        else:
            df = df.Define("bfweight", "1")
            weight = "bfweight"

        # Select Pc regions 
        df1 = select_range(df, f"LcDst_ECC{hyp}_M", 4300, 4320)
        df2 = select_range(df, f"LcDst_ECC{hyp}_M", 4430, 4450)
        df3 = select_range(df, f"LcDst_ECC{hyp}_M", 4440, 4470)

        namesdict = {
            df1: "Pc4312",
            df2: "Pc4440",
            df3: "Pc4457",
        }

        for dfres in [df1, df2, df3]:

            # Building resolution model
            DataSet = dfres.Book(ROOT.std.move(ROOT.RooDataSetHelper(f"dataset{namesdict[dfres]}{hyp}", "", ROOT.RooArgSet(fitvar))), (f"LcDst_M_res{hyp}",)).GetValue()

            w.Import(DataSet)

Stack:

[#1] INFO:DataHandling -- RooDataSetHelper::FillDataSet(datasetPc4312pi0) Skipping event because resvarPc4312pi0 cannot accommodate the value  *** Break *** segmentation violation
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy_backend3_10.6.28.00.so] (anonymous namespace)::TExceptionHandlerImp::HandleException(int) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libCore.6.28.00.so] TUnixSystem::DispatchSignals(ESignals) (no debug info)
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libROOTDataFrame.6.28.00.so] ROOT::Detail::RDF::RLoopManager::CleanUpNodes() (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libROOTDataFrame.6.28.00.so] ROOT::Detail::RDF::RLoopManager::Run(bool) (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[<unknown binary>] (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy_backend3_10.6.28.00.so] WrapperCall(long, unsigned long, void*, void*, void*) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy_backend3_10.6.28.00.so] Cppyy::CallR(long, void*, unsigned long, void*) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy3_10.6.28.00.so] CPyCppyy::(anonymous namespace)::InstanceRefExecutor::Execute(long, void*, CPyCppyy::CallContext*) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy3_10.6.28.00.so] CPyCppyy::CPPMethod::ExecuteFast(void*, long, CPyCppyy::CallContext*) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy3_10.6.28.00.so] CPyCppyy::CPPMethod::ExecuteProtected(void*, long, CPyCppyy::CallContext*) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy3_10.6.28.00.so] CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object*, _object*, CPyCppyy::CallContext*) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/lib/libcppyy3_10.6.28.00.so] CPyCppyy::(anonymous namespace)::mp_call(CPyCppyy::CPPOverload*, _object*, _object*) (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] _PyEval_EvalFrameDefault (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] _PyEval_Vector (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] run_mod (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] pyrun_file (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] _PyRun_SimpleFileObject (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] _PyRun_AnyFileObject (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] pymain_run_file_obj (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] pymain_run_file (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] pymain_run_python (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] Py_RunMain (no debug info)
[/usr/local/anaconda3/envs/Lb2LcDstKp310/bin/python3.10] main (no debug info)
[/usr/lib/dyld] start (no debug info)
Traceback (most recent call last):
  File "/Users/mindaugassarpis/Work/Lb2LcDstK/scripts/Resolution/try.py", line 112, in <module>
    rooDataSet = dfres.Book(ROOT.std.move(ROOT.RooDataSetHelper(f"dataset{namesdict[dfres]}{hyp}", "", ROOT.RooArgSet(data_fitted))), [f"LcDst_M2_GeV2_res{hyp}"]).GetValue()
cppyy.ll.SegmentationViolation: const RooDataSet& ROOT::RDF::RResultPtr<RooDataSet>::GetValue() =>
    SegmentationViolation: segfault in C++; program state was reset

Dear @Mindaugas_Sarpis ,

I can ask @jonas just to check if there is anything obvious that doesn’t look good. But I guess if you say it works on Linux then it’s probably something at a deeper level.

To debug I would at least need some input data (either yours or some simulated one) plus the full snippet to reproduce.

Cheers,
Vincenzo

I understand… I will try to work on a reproducer.

The crash was caused by the fit variable defined before and imported into the workspace not being able to accommodate some of the values from df column. In plain implementation, this just gives a warning, but here I got a segfault. Tested on root 6.26 and 6.26, python 3.10, 3.11 and got the same results. Fixed the issue by expanding the fit variable ranges, but maybe someone should address this.

1 Like

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

Thanks for the investigation! If you fee like this should be addressed, please open a GitHub issue in the ROOT repository with a reproducer of the problem, otherwise we’ll 100 % forget about this: