mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
YJIT: Print Rc strong and weak count on assert failure
For <https://bugs.ruby-lang.org/issues/21716>, the panic is looking like some sort of third party memory corruption, with YJIT taking the fall. At the point of this assert, the assembler has dropped, so there's nothing in YJIT's code other than JITState that could be holding on to these transient `PendingBranchRef`. The strong count being more than a handful or the weak count is non-zero shows that someone in the process (likely some native extension) corrupted the Rc's counts.
This commit is contained in:
parent
f3d1557d5c
commit
eaa952b536
Notes:
git
2025-12-16 19:57:22 +00:00
@ -2419,7 +2419,9 @@ impl<'a> JITState<'a> {
|
||||
// Pending branches => actual branches
|
||||
outgoing: MutableBranchList(Cell::new(self.pending_outgoing.into_iter().map(|pending_out| {
|
||||
let pending_out = Rc::try_unwrap(pending_out)
|
||||
.ok().expect("all PendingBranchRefs should be unique when ready to construct a Block");
|
||||
.unwrap_or_else(|rc| panic!(
|
||||
"PendingBranchRef should be unique when ready to construct a Block. \
|
||||
strong={} weak={}", Rc::strong_count(&rc), Rc::weak_count(&rc)));
|
||||
pending_out.into_branch(NonNull::new(blockref as *mut Block).expect("no null from Box"))
|
||||
}).collect()))
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user