Skip to content

[RF] Delete fit objects before continuing in rs401d_FeldmanCousins.py#22853

Open
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:roo_del
Open

[RF] Delete fit objects before continuing in rs401d_FeldmanCousins.py#22853
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:roo_del

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Similar to 49fb353.

The Python version of this tutorial sporadically crashes on CI with the upcoming cppyy upgrade. It is the same overlapping-heap-ownership problem that was worked around for rf619_discrete_profiling.py in 49fb353.

The nll/pll pair used for the likelihood surface in pad 3 is not needed after that plot. Deleting it right there tears down the NLL evaluation machinery at a well-defined point instead of at interpreter shutdown, where the order of cleanups is less controlled. With this change the previously deterministic poisoned repro (4/4 crashing) passes 3/3, and plain and ctest invocations pass as well.

Similar to 49fb353.

The Python version of this tutorial sporadically crashes on CI with the
upcoming cppyy upgrade. It is the same overlapping-heap-ownership
problem that was worked around for `rf619_discrete_profiling.py` in
49fb353.

The nll/pll pair used for the likelihood surface in pad 3 is not needed
after that plot. Deleting it right there tears down the NLL evaluation
machinery at a well-defined point instead of at interpreter shutdown,
where the order of cleanups is less controlled. With this change the
previously deterministic poisoned repro (4/4 crashing) passes 3/3, and
plain and ctest invocations pass as well.
@guitargeek guitargeek self-assigned this Jul 20, 2026
@guitargeek
guitargeek requested review from couet and dpiparo as code owners July 20, 2026 07:34
@github-actions

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 13h 17m 6s ⏱️
 3 872 tests  3 871 ✅ 0 💤 1 ❌
75 041 runs  75 040 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 1f829f4.

Comment on lines +167 to +171
# The profile likelihood and the NLL are not needed anymore. Delete them
# already here, so that the NLL evaluation machinery is not torn down at
# interpreter shutdown, where the order of cleanups is less controlled.
del pll
del nll

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not to block this PR, but in general it's weird/a code smell to have to use del in Python at determined places. Do we have an idea of how this particular scenario could be fixed with e.g. appropriate Pythonizations or changes in the bindings layer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's hard to investigate, because the crash only happens in the cppyy upgrade PR. I guess some different destruction ordering there turns out to be catastrophic for RooFit.

My plan was to first make sure that this works for old and new cppyy by making the destruction order more deterministic with this PR, and then at a later point revisit the dels in the tutorial when there is time.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants