[RF] Delete fit objects before plotting in rf619_discrete_profiling.py#22830
Merged
Conversation
The Python version of this tutorial sporadically crashes on CI (and deterministically in some local invocations) with memory corruption that is detected in cling's JIT at interpreter shutdown, e.g. as "StringMapImpl::RemoveKey(): Didn't find key?" on builds with LLVM assertions, or as a segfault in llvm::Module::dropAllReferences() / MDNode::dropAllReferences() during ~TCling. Watchpoint forensics show recycled heap blocks that end up shared between the NLL evaluation machinery (RooFit::Evaluator data-token bookkeeping on the compiled model clones) and IR objects of modules that cling JITs during the plotting phase, with the final stale write coming from RooFit::Evaluator::~Evaluator() at interpreter shutdown. Deleting the minimizer and the NLL right after the fits closes that window: the evaluator and the owned graph clones are torn down at a well-defined point before the plotting phase compiles new wrappers, and not during the less controlled interpreter shutdown. With this change the previously reproducible crash (8/8 failing runs in a bare invocation) disappears (8/8 + 3/3 ctest passing). This is a workaround at the tutorial level; the underlying overlapping heap ownership deserves a separate AddressSanitizer investigation.
siliataider
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Python version of this tutorial sporadically crashes on CI (and deterministically in some local invocations) with memory corruption that is detected in cling's JIT at interpreter shutdown, e.g. as "StringMapImpl::RemoveKey(): Didn't find key?" on builds with LLVM assertions, or as a segfault in llvm::Module::dropAllReferences() / MDNode::dropAllReferences() during ~TCling.
Watchpoint forensics show recycled heap blocks that end up shared between the NLL evaluation machinery (RooFit::Evaluator data-token bookkeeping on the compiled model clones) and IR objects of modules that cling JITs during the plotting phase, with the final stale write coming from RooFit::Evaluator::~Evaluator() at interpreter shutdown.
Deleting the minimizer and the NLL right after the fits closes that window: the evaluator and the owned graph clones are torn down at a well-defined point before the plotting phase compiles new wrappers, and not during the less controlled interpreter shutdown. With this change the previously reproducible crash (8/8 failing runs in a bare invocation) disappears (8/8 + 3/3 ctest passing).
This is a workaround at the tutorial level; the underlying overlapping heap ownership deserves a separate AddressSanitizer investigation.