-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[PyROOT] Fix a GIL deadlock in THx.Fit #21129
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
Conversation
|
Nice, and compute intense functions like these is exactly when the GIL should be released to enable Python multithreading. Did you check the Pythonization also works for TH1-derived classes? |
vepadulano
left a comment
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.
Nice thanks!
We checked in the interpreter: >>> import ROOT
>>> ROOT.TH2.Fit.__release_gil__
True |
Test Results 22 files 22 suites 3d 21h 25m 16s ⏱️ Results for commit 2232fb9. ♻️ This comment has been updated with latest results. |
|
I've taken a look at the MacOS failures. There seems to be some other kind of interference on that platform for two different types of functions that release the GIL, namely the distributed RDataFrame execution and now TH1.Fit. Needs investigation |
vepadulano
left a comment
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.
Thank you @siliataider for investigating and fixing the failures on MacOS!
The changes LGTM, maybe consider the ruff format suggestions.
|
Some of the |
TH1.Fit might call into Python functions, which would require the GIL to be held. If TH1.Fit holds it, though, the process deadlocks. Here, the GIL is released before TH1.Fit, which runs fully in C++ anyway. Fix root-project#21080.
This saves startup times and collects TH1 tests in one place.
The timeout of the test is reduced because the deadlock would otherwise show only after 1500s.
0319cda to
2232fb9
Compare
|
Thanks for this fix! maybe something to |
|
/backport to 6.38 |
|
/backport to 6.38 |
|
This PR has been backported to branch 6.38: |
|
/backport to 6.38 |
1 similar comment
|
/backport to 6.38 |
|
This PR has been backported to branch 6.38: #21198 |
TH1.Fit might call into Python functions, which would require the GIL to
be held. If TH1.Fit holds it, though, the process deadlocks.
Here, the GIL is released before TH1.Fit, which runs fully in C++
anyway.
A test was added with a 30s timeout. It completes in about 1s, unless the
GIL deadlock is maintained.
Fix #21080.