Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TBulkRead fails with "fExtraBasket should have been set to nullptr by GetFreshBasket" #6416

Closed
ktf opened this issue Sep 22, 2020 · 6 comments · Fixed by #6519
Closed

TBulkRead fails with "fExtraBasket should have been set to nullptr by GetFreshBasket" #6416

ktf opened this issue Sep 22, 2020 · 6 comments · Fixed by #6519
Assignees
Labels

Comments

@ktf
Copy link
Contributor

ktf commented Sep 22, 2020

Describe the bug

I am trying to use the new TBulkRead API. I have a set of branches that I read with (updated with full reproducer):

#include <TBufferFile.h>
#include <TFile.h>
#include <TTree.h>
#include <iostream>

void foo() {
  auto f = TFile::Open("http://hyperloop.cern.ch/train-workdir/testdata/LFN/alice/data/2015/LHC15o/000245064/pass5_lowIR/PWGZZ/Run3_Conversion/71_20200915-2255_child_1/0935/AO2D.root");
  auto t = (TTree*)f->Get("O2track");
  auto e = t->GetEntries();
  auto b = t->GetBranch("fAlpha");
  assert(b);
  int pos = 0;
  while (pos < e) {
    TBufferFile buf(TBuffer::EMode::kWrite, 32*1024);
    auto &r = b->GetBulkRead();
    auto s = r.GetBulkEntries(pos, buf);
    pos += s;
    std::cout << "Read " << s << " elements " << std::endl;
    b->Print();
  }
}

however when I get to read the last but one buffer, I get:

Read 1000 elements
*Br 3398 :fAlpha    : fAlpha/F                                               *
*Entries :  3399743 : Total  Size=   13939349 bytes  File Size  =   11798760 *
*Baskets :     3399 : Basket Size=       1000 bytes  Compression=   1.17     *
*............................................................................*
Fatal: fExtraBasket == nullptr && "fExtraBasket should have been set to nullptr by GetFreshBasket" violated at line 1474 of `/Users/ktf/src/sw/SOURCES/ROOT/v6-20-02-alice7/v6-20-02-alice7/tree/tree/src/TBranch.cxx'
aborting

Expected behavior

Reading all the baskets, with the last one returning the appropriate number of entries.

To Reproduce

Setup

6.20.0

Additional context

TFile with a few TTree in it, all the branches have basic types or arrays of basic types.

@ktf ktf added the bug label Sep 22, 2020
@github-actions github-actions bot added this to Needs triage in Triage Sep 22, 2020
@ktf
Copy link
Contributor Author

ktf commented Sep 24, 2020

For the record, for other files, with larger baskets, it happens in the middle of the tree reading.

@pzhristov
Copy link

@ktf There is an orphan p->Print() in the reproducer above.

@ktf
Copy link
Contributor Author

ktf commented Sep 25, 2020

@pzhristov fixed

@ktf
Copy link
Contributor Author

ktf commented Sep 25, 2020

If I understand correctly TBranch::GetBasketAndFirst() sometimes does not go through the GetFreshBasket statement, but through GetFreshCluster(). Line 1223-1226 of TBranch.cxx.

@pcanal
Copy link
Member

pcanal commented Sep 30, 2020

It turns out that #6417 and this issue have the same original cause (not being able to handle basket that are not stored (on their own) in the file).

@pcanal
Copy link
Member

pcanal commented Sep 30, 2020

If I understand correctly TBranch::GetBasketAndFirst() sometimes does not go through the GetFreshBasket statement, but through GetFreshCluster(). Line 1223-1226 of TBranch.cxx

Indeed and the rest of the code assumed it always went through GetFreshBasket.

pcanal added a commit to pcanal/root that referenced this issue Sep 30, 2020
ktf pushed a commit to ktf/root that referenced this issue Sep 30, 2020
ktf pushed a commit to alisw/root that referenced this issue Sep 30, 2020
pcanal added a commit to pcanal/root that referenced this issue Sep 30, 2020
pcanal added a commit to pcanal/root that referenced this issue Sep 30, 2020
pcanal added a commit to pcanal/root that referenced this issue Sep 30, 2020
pcanal added a commit to pcanal/root that referenced this issue Sep 30, 2020
pcanal added a commit to pcanal/root that referenced this issue Oct 6, 2020
pcanal added a commit to pcanal/root that referenced this issue Oct 6, 2020
@eguiraud eguiraud moved this from Needs triage to Rest in Triage Oct 6, 2020
Triage automation moved this from Rest to Closed Oct 6, 2020
pcanal added a commit that referenced this issue Oct 6, 2020
pcanal added a commit that referenced this issue Oct 6, 2020
@hahnjo hahnjo added this to Issues in Fixed in 6.24/00 via automation Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants