-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Cleanup also current file in TChain::GetEntries #19866
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
base: master
Are you sure you want to change the base?
Cleanup also current file in TChain::GetEntries #19866
Conversation
tree/treeplayer/src/TTreeReader.cxx
Outdated
if (const auto curFile = fTree->GetCurrentFile()) { | ||
if (!fTree->GetTree()) { | ||
fTree->LoadTree(0); | ||
} | ||
if (fTree->GetTree()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this if-statement is no longer needed if you have the assert above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Although these changes are causing further side effects in a few tests. We may have to revert everything and go back to the drawing board
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
if (auto curFile = fTree->GetCurrentFile()) {
if (!fTree->GetTree()) {
fTree->LoadTree(0);
curFile = fTree->GetCurrentFile();
}
if (fTree->GetTree()) {
(In case the side-effects appear when curFile is null)
Test Results 19 files 19 suites 3d 10h 12m 28s ⏱️ For more details on these failures, see this check. Results for commit afb31f5. ♻️ This comment has been updated with latest results. |
The previous code was invalidating the tree after the full search through the list of files to gather the number of entries, but it was not taking care of the last file that had been opened.
Co-authored-by: ferdymercury <[email protected]>
67284a6
to
afb31f5
Compare
I have updated this PR with a second version of the approach. It now also deals with the root cause which is the side-effect caused by |
Followup to #19817
In the method we need to check if the current TTree has a TTreeCache associated with the current file. The previous logic was getting the pointer to the current file but calling LoadTree afterwards, which deleted the current file and switched it for a new instance. In turn, this would cause bad reads as highlighted by a run of the associated unit test with the address sanitizer:
Change the logic to instead load the tree beforehand, so the pointer to the file will be the correct one.
Fixes CI failures such as https://github.com/root-project/root/actions/runs/17610706130/job/50031825233?pr=19860#step:6:4762