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

Fix potential crash of the rreader test on Windows #13782

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

bellenot
Copy link
Member

@bellenot bellenot commented Oct 3, 2023

Delete the TFile pointers, preventing a potential crash in TROOT::CloseFiles() when trying to call the Close() method on TWebSocket/TWebFile via the interpreter CallFunc_Exec on Windows (visible with LLVM 16)

Delete the `TFile` pointers, preventing a potential crash in `TROOT::CloseFiles()` when trying to call the `Close()` method on `TWebSocket`/`TWebFile` via the interpreter `CallFunc_Exec` on Windows (visble with LLVM 16)
@bellenot bellenot requested a review from hahnjo October 3, 2023 07:48
@bellenot bellenot requested a review from lmoneta as a code owner October 3, 2023 07:48
@bellenot bellenot self-assigned this Oct 3, 2023
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/default
How to customize builds

@@ -53,6 +53,7 @@ void TrainClassificationModel()
factory->BookMethod(dataloader, TMVA::Types::kBDT, "BDT", "!V:!H:NTrees=100:MaxDepth=2");
factory->TrainAllMethods();
output->Close();
delete data;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think wrapping the file in a unique pointer would be the preferred solution, like this:

std::unique_ptr<data>{TFile::Open(filename.c_str())};

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks for the suggestion

Copy link
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the memory leaks!

If you have time, please consider updating this to use smart pointers instead of raw pointers to TFile.

@hahnjo hahnjo mentioned this pull request Oct 3, 2023
23 tasks
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/default
How to customize builds

@github-actions
Copy link

github-actions bot commented Oct 3, 2023

Test Results

       11 files         11 suites   2d 9h 43m 7s ⏱️
  2 483 tests   2 481 ✔️ 0 💤 2
26 228 runs  26 225 ✔️ 0 💤 3

For more details on these failures, see this check.

Results for commit 516d36c.

@bellenot bellenot merged commit 6ee27eb into root-project:master Oct 3, 2023
10 of 15 checks passed
@bellenot bellenot deleted the fix-rreader branch October 3, 2023 11:25
@phsft-bot
Copy link
Collaborator

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

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-3.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2023-10-03T14:09:36.186Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1126 (message):

maksgraczyk pushed a commit to maksgraczyk/root that referenced this pull request Jan 12, 2024
* Fix potential crash of the rreader test on Windows

Delete the `TFile` pointers, preventing a potential crash in `TROOT::CloseFiles()` when trying to call the `Close()` method on `TWebSocket`/`TWebFile` via the interpreter `CallFunc_Exec` on Windows (visble with LLVM 16)

* Use `std::unique_ptr` instead of deleting the pointers (thanks Jonas)
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.

3 participants