A TTree with a friend TChain doesn't propagate all errors happening in the chain
メンテナーはふだん 1 日以内に返信
@vepadulano がすでに取り組んでいます。
2026年11月2日 から。
評価
調査の方向性
Start with the friend-loading block in TTree::GetEntry (tree/tree/src/TTree.cxx), where the return value of LoadTreeFriend is checked, and with TTree::LoadTreeFriend itself. Build the reproducer root_friend_missing_file_bug.C from the issue, which uses a TChain friend pointing to a missing file. Done means events.GetEntry(0) returns a negative value on that failure, and the return-code convention for missing entries (-2) is kept. The sign and value conventions need a maintainer decision first.
索引モデルが issue の本文から書いたものです。
説明
Check duplicate issues.
- Checked for duplicates
Description
When a TTree has a friend TChain, the tree's GetEntry() does not return an error if the chain encounters one. This is caused by code in TTree::GetEntry(), which fails to return forward failures signaled by LoadTreeFriend():
if ( t->LoadTreeFriend(entry,this) >= 0 ) { // Returns < 0 on error
nb = t->GetEntry(t->GetReadEntry(),getall);
} else nb = 0; // Error path; I think this should be -1 for `LoadTreeFriend` errors except on missing entries (-2)
}
if (nb < 0) return nb; // Zero is rightfully not an error: it appears when no branch in the friend is enabled
The important point for reproduction is to make LoadTreeFriend fail. With TChain, this is trivially achieved with a file that cannot be loaded or doesn't contain the input tree. With TTree, this is only potentially possible in a very contrived scenario with friends of friends and a custom fNotify.
Reproducer
Run with root -l -q root_friend_missing_file_bug.C.
#include <TChain.h>
#include <TFile.h>
#include <TTree.h>
#include <stdio.h>
void root_friend_missing_file_bug()
{
// Setup: 1-event main file
{
TFile f("main.root", "RECREATE");
TTree t("events", "events");
int x = 0;
t.Branch("x", &x);
t.Fill();
f.Write();
}
TFile f("main.root", "READ");
auto &events = *f.Get<TTree>("events"); // Repro also works with a TChain here
TChain corrections("aux");
corrections.Add("/ThisFileDoesNotExist.root");
// Repro also works with branches in corrections
events.AddFriend(&corrections);
// The tree returns 4, i.e., doesn't report the missing file.
printf("events.GetEntry(0) = %d (failure if <= 0)\n", events.GetEntry(0));
// The chain does return an error-ish value (0, inconsistent with the TTree API that
// would return -1, but changing it would be a breaking change).
printf("corrections.GetEntry(0) = %d (failure if <= 0)\n", corrections.GetEntry(0));
}
ROOT version
6.38.00, but code confirmed identical in master.
------------------------------------------------------------------
| Welcome to ROOT 6.38.00 https://root.cern |
| (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Feb 03 2026, 21:14:06 |
| From tags/6-38-00@6-38-00 |
| With g++ (GCC) 15.2.0 std202302 |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
Installation method
LCG 109
Operating system
lxplus
Additional context
I wanted to identify the origin of errors and handle them appropriately based on their category (unrecoverable tree/file not found vs transient network issues for which a retry can work).
Full disclosure: this bug was found and investigated with the help of AI. I take full responsibility for the report.
- 主要言語
- C++
- スター
- 3.3k
- フォーク
- 1.6k
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 222
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
root-project/root のほかの issue
-
in:RooFit new feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
root-project/root#23985 ·
メンテナーはふだん 1 日以内に返信
-
[PyROOT] Every ROOT.Math access leaks memory (failed cppyy.gbl lookup in the facade fallback is not cached)対応中かも @guitargeek が 1 日前に担当しました。 オープンbug in:Python Interface
root-project/root#23978 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Build] `fail-on-missing` contract not respected for `NOT http AND webgui`対応中かも @guitargeek が 6 日前に担当しました。 オープンbug in:Build System
root-project/root#23907 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Header cleanup campaign対応中かも @hageboeck が 8 日前に担当しました。 オープンimprovement in:Core Libraries
root-project/root#23880 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
TDataMember::GetOffset interfers to TDataMember::GetOffsetCint対応中かも @pcanal が 14 日前に担当しました。 オープンbug in:Core Libraries
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
root-project/root#23777 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
root-project/root の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
mw00/project-maya#877 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
llvm/offload-test-suite#1703 ·
メンテナーはふだん 1 日以内に返信
-
backlog bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
EchoTools/nevr-runtime#2154 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
BGI-shenzhen/PopLDdecay#25 ·