Skip to content

[TMVA] Throw an exception when input file for using RBDT does not exist.#9499

Merged
lmoneta merged 2 commits intoroot-project:masterfrom
lmoneta:fix_tmva_rbdt_crash
Feb 2, 2022
Merged

[TMVA] Throw an exception when input file for using RBDT does not exist.#9499
lmoneta merged 2 commits intoroot-project:masterfrom
lmoneta:fix_tmva_rbdt_crash

Conversation

@lmoneta
Copy link
Copy Markdown
Member

@lmoneta lmoneta commented Jan 6, 2022

This PR fixes #9316

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

@lmoneta lmoneta self-assigned this Jan 6, 2022
@phsft-bot
Copy link
Copy Markdown

Build failed on mac11/cxx17.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1015/python3.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

{
// Get number of output nodes of the forest
auto file = TFile::Open(filename.c_str(), "READ");
if (!file) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!file) {
if (!file || file->IsZombie()) {

@@ -48,6 +48,9 @@ public:
{
// Get number of output nodes of the forest
auto file = TFile::Open(filename.c_str(), "READ");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is the file leaked?

Suggested change
auto file = TFile::Open(filename.c_str(), "READ");
std::unique_ptr<TFile> file{TFile::Open(filename.c_str())};

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, correct. It was only closed but not deleted the file ! Thanks for finding this!

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

Copy link
Copy Markdown
Contributor

@eguiraud eguiraud left a comment

Choose a reason for hiding this comment

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

LGTM. GetObjectSafe is type-unsafe, but that's for another PR 😄

@lmoneta lmoneta merged commit c80d2ac into root-project:master Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TMVA] Experimental::RBDT segfaults if input file does not exist

3 participants