Skip to content

[Tree] Emit error before crashing when reading type w/ no dictionary#21349

Open
dpiparo wants to merge 1 commit intoroot-project:masterfrom
dpiparo:fix_10524
Open

[Tree] Emit error before crashing when reading type w/ no dictionary#21349
dpiparo wants to merge 1 commit intoroot-project:masterfrom
dpiparo:fix_10524

Conversation

@dpiparo
Copy link
Member

@dpiparo dpiparo commented Feb 23, 2026

as TTree would do.

Fixes #10254

@dpiparo dpiparo self-assigned this Feb 23, 2026
@dpiparo dpiparo requested a review from pcanal as a code owner February 23, 2026 12:45
@github-actions
Copy link

github-actions bot commented Feb 23, 2026

Test Results

    20 files      20 suites   2d 18h 5m 47s ⏱️
 3 777 tests  3 722 ✅ 0 💤 55 ❌
68 590 runs  68 531 ✅ 4 💤 55 ❌

For more details on these failures, see this check.

Results for commit fd476a3.

♻️ This comment has been updated with latest results.

}
} // namespace cling

namespace ROOT::Internal::TTreeReaderHelpers {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be unused.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this is a remnant of a refactoring. Sorry about that.

Copy link
Member

@vepadulano vepadulano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am probably missing the bigger picture here, I left a few comments, some are corrections and some are for discussion

const char *writeStlWithoutProxyMsg =
"The class requested (%s) for the branch \"%s\" "
"is an instance of an stl collection and does not have a compiled CollectionProxy. "
"Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
"Please generate the dictionary for this collection (%s) to avoid writing corrupted data.";

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx.

"The class requested (%s) for the branch \"%s\" "
"is an instance of an stl collection and does not have a compiled CollectionProxy. "
"Please generate the dictionary for this collection (%s) to avoid to write corrupted data.";
// This error message is repeated several times in the code. We write it once.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this comment about? The error message will be printed once per function call, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct. I need to address that.

Copy link
Member

@vepadulano vepadulano Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading again this code and the code in TTree, I think I understand that the comment merely mentions that the same string needs to be used in multiple different functions, so instead of repeating it multiple times in the code, it is "written once" in this function. The error will still be printed once each time this situation is triggered, as it should.

TEST(TTreeReaderBasic, WarnNoDict)
{
using rareType = std::map<std::string, bool>;
auto c = TClass::GetClass(typeid(rareType));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check for validity of the TClass * here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TClass will always return for templates, because of automatic instantiation. We can decide to be on the safe side though, and even put an error to detect the ill-defined case where that does not happen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be then GetClass<rareType>?

Comment on lines +613 to +615
// Create the input file in a separate process.
// This is necessary because we want to create a dictionary but not have it at disposal
// for the read
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other tests we treat this situation with a separate executable that creates the dictionary, then use ROOTTEST_GENERATE_DICTIONARY with the proper FIXTURES_SETUP to create a build dependency. Ideally we would do the same here, although I wouldn't put this as a blocker for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TTreeReader] No diagnostics printed before crash when reading a type with no dictionaries

3 participants