Segfault during large snapshot

While executing a rather large snapshot (large enough that ROOT automatically creates a new file), I get a segfault: https://gist.github.com/beojan/34447697387a3bf92c78303dadebd088.

The error is

Fatal in <TBufferFile::AutoExpand>: Request to expand to a negative size, likely due to an integer overflow: 0xf0c1058c for a max of 0x7ffffffe.


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Trying to draw some of the snapshotted variables:

root [2] jets->Draw("pt")
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
Error in <TRint::HandleTermInput()>: std::length_error caught: vector::_M_default_append
root [3] jets->Print()
******************************************************************************
*Tree    :jets      : jets                                                   *
*Entries :    10538 : Total =    295918680322 bytes  File  Size = 99999119377 *
*        :          : Tree compression factor =   2.96                       *
******************************************************************************
*Br    0 :pt        : vector<float>                                          *
*Entries :    10538 : Total  Size=     158874 bytes  File Size  =      33613 *
*Baskets :       89 : Basket Size=      51200 bytes  Compression=   4.66     *
*............................................................................*
*Br    1 :eta       : vector<float>                                          *
*Entries :10538 : Total  Size=62937593477 bytes  File Size  = 21778789241 *
*Baskets :     1894 : Basket Size=      51200 bytes  Compression=   2.89     *
*............................................................................*
*Br    2 :phi       : vector<float>                                          *
*Entries :10538 : Total  Size=117691675891 bytes  File Size  = 38365202744 *
*Baskets :     4665 : Basket Size=   25600000 bytes  Compression=   3.07     *
*............................................................................*
*Br    3 :M         : vector<double>                                         *
*Entries :    10538 : Total  Size=     621049 bytes  File Size  =     510840 *
*Baskets :       89 : Basket Size=      51200 bytes  Compression=   1.21     *
*............................................................................*
*Br    4 :tag       : vector<int>                                            *
*Entries :10538 : Total  Size=115288579945 bytes  File Size  = 39854466057 *
*Baskets :     5220 : Basket Size=      51200 bytes  Compression=   2.89     *
*............................................................................*
*Br    5 :wgt       : wgt/F                                                  *
*Entries :    10538 : Total  Size=      50459 bytes  File Size  =       8542 *
*Baskets :       89 : Basket Size=      51200 bytes  Compression=   5.66     *
*............................................................................*

The only vector branch I can draw is “M” (which incidentally is the only one which is calculated rather than being copied from the input).

Maybe @pcanal could have a look here?

*Br    1 :eta       : vector<float>                                          *
*Entries :10538 : Total  Size=62937593477 bytes  File Size  = 21778789241 *
*Baskets :     1894 : Basket Size=      51200 bytes  Compression=   2.89     *

Is it expect that this branch would contains 58Gb of data? I.e. something like 1.5 millions of floats per entries?

What is the command leading to the crash?

What is the snapshot you use?

No. It seems it’s writing garbage into any column that is copied directly from the input.
My code is:

{
    using namespace std;
    using namespace ROOT;
    namespace VO = ROOT::VecOps;

    auto mass = [](const Math::PtEtaPhiEVector& vec) { return vec.M(); };

    vector<string> files{};
    copy(istream_iterator<string>(cin), istream_iterator<string>(), back_inserter(files));
    for (const auto& input : files) {
        TFile* input_file = TFile::Open(input.c_str());
        if (input_file->IsZombie()) {
            cout << "Zombie file skipped: "  << input << endl;
        }
        else if (input_file->TestBit(TFile::kRecovered)) {
			cout << "Recovered file NOT skipped: " << input << endl;
        }
        else {
        }
		input_file->Close();
    }

    double n = 0;
    auto df = RDataFrame("XhhMiniNtuple", files)
                    .Filter("passResolvedGRL != 0")
                    .Filter("cleanEvent == 1")
                    .Define("wgt", "weight * weight_xs * weight_pileup")
                    .Define("tag", "resolvedJets_is_MV2c10_FixedCutBEff_70")
                    .Define("pt", "resolvedJets_pt")
                    .Define("eta", "resolvedJets_eta")
                    .Define("phi", "resolvedJets_phi")
                    .Define("E", "resolvedJets_E")
                    .Define("Vec",
                            "ROOT::VecOps::Construct<ROOT::Math::PtEtaPhiEVector>(pt, eta, phi, E)")
                    .Define("M",
                            [&mass](const VO::RVec<Math::PtEtaPhiEVector>& vec) {
                                auto v = VO::Map(vec, mass);
                                return vector<double>(v.begin(), v.end());
                            },
                            {"Vec"});
    df.Report()->Print();
    df.Snapshot("jets", "data17.root", {"pt", "eta", "phi", "M", "tag", "wgt"});
}

Could you provide at least one of the input files so that we can reproduce the problem?

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