fix: release captured and hash-slice temporary owners - #1204
Merged
Conversation
Add the issue #1132 regression, document the failed per-capture accounting approach, and record the owner-ledger design for a Perl-exact implementation. Known limitation: the current partial RuntimeScalar change does not yet pass the focused regression or the full make gate; follow-up work starts from the owner-ledger design. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <2237389410+openai-codex[bot]@users.noreply.github.com>
Model a captured pad as one semantic owner shared by all closures, and consult that ownership during weak-reference cleanup. Transfer the owner on reassignment and release it on weaken, unweaken, and final capture release. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <2237389410+openai-codex[bot]@users.noreply.github.com>
Honor semantic capture owners at the weak-reference clearing boundary, and allow their lifecycle lookup through WEAKLY_TRACKED states. Add a focused, system-Perl-validated weak callback-slot regression and record the Future and Net::Async::HTTP acceptance evidence in the owner-ledger design. Generated with Codex (OpenAI) Co-Authored-By: Codex <codex@openai.com>
Document the remaining JVM closure-captured socket return boundary and retain the focused IO::Socket fileno regression while that case is completed. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <codex@openai.com>
Explicit JVM returns now clean only frame-local scalar slots, leaving an enclosing closure capture responsible for an anonymous socket assigned during the callback. Refs: dev/design/refcount-owner-ledger.md Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <codex@openai.com>
Keep the DBIx aggregate compatibility adjustment inside DESTROY so ordinary fresh lexical B probes report their single owner. Expose diagnostic owner counts for the remaining IO::Async scalar-store investigation and update the Issue #1132 handoff. Generated with [Codex](https://openai.com/codex) Co-Authored-By: Codex <codex@openai.com>
Keep trace-only source provenance for deferred scalar releases until drain or cancellation, and record the completed diagnostic step in the owner-ledger design. Generated with [Codex](https://openai.com/codex/) Co-Authored-By: Codex <codex@openai.com>
Expose active and queued owner provenance for a selected referent without creating diagnostic reachability, and record the next Net exact-count step. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <noreply@openai.com>
Document that the remaining Net exact-count surplus is not captured-pad, scalar-store, or missed-boundary ownership. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <noreply@openai.com>
Track method-invocant and blessing-temporary holds in the owner trace, and keep parallel deferred trace metadata aligned with scoped queue drains. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <noreply@openai.com>
Record scalar-reference, weak-promotion, closure-capture, and tie-wrapper holds in assertion-boundary owner traces. Document that the JVM-only Net timeout excess remains outside these paths. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <noreply@openai.com>
Include semantic captured-pad owner counts in assertion-boundary snapshots and record the JVM-only Net::Async::HTTP investigation handoff. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <noreply@openai.com>
Record PR 1204 as the required continuation target, the exact diagnostic state, retained commits, and receiving-worker validation responsibility. Generated with Codex (https://openai.com/codex) Co-Authored-By: Codex <noreply@openai.com>
Always schedule the captured scalar's normal deferred decrement. The former reachability-based transfer discarded a capture count while an IO::Async loop temporarily owned the object and never restored it after notifier removal. Add a system-Perl-validated exact-refcount regression and document the Net::Async::HTTP 0.50 t/30timeout.t JVM/interpreter verification. Generated with [OpenAI Codex](https://openai.com/codex/) Co-Authored-By: OpenAI Codex <codex@openai.com>
Transfer compiler-created RHS and staging scalar-store owners after HASH_SLICE_SET creates durable hash slots. This fixes the interpreter-only Net::Async::HTTP t/32remove exact-refcount drift and adds permanent coverage. Refs: dev/design/refcount-owner-ledger.md Generated with [OpenAI Codex](https://openai.com/codex/) Co-Authored-By: OpenAI Codex <codex@openai.com>
fglock
force-pushed
the
fix/issue-1132-closure-lifetime
branch
from
September 1, 2026 21:55
01b82f9 to
d6a489c
Compare
fglock
marked this pull request as ready for review
September 1, 2026 21:55
Release a scope-exited captured pad's semantic owner at the pre-END boundary when no END block can reach it. This restores DESTROY for discarded eval captures and returns Perl core run/fresh_perl.t to its 73/91 baseline. Refs: dev/design/refcount-owner-ledger.md Generated with [OpenAI Codex](https://openai.com/codex/) Co-Authored-By: OpenAI Codex <codex@openai.com>
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.
Summary
Fix selective-reference-count owner leaks exposed by Net::Async::HTTP and
restore global destruction for discarded eval captures:
owner is removed.
HASH_SLICE_SETRHS and stagingowners once
RuntimeHash.setSlice()has created the durable slots.ENDboundary only when no
ENDblock can reach it.The second fix resolves the exact
t/32remove.tconnection count: theinterpreter now reports 4 references during removal and 1 at EOF, matching
system Perl and the JVM backend. The third restores
run/fresh_perl.ttest 75to the 73/91 baseline by allowing the typed lexical referent's
DESTROYtorun at global destruction.
Validation
provefor the two new focused owner regressions on system Perl.make(full unit suite), including the final regression-fix gate.make check-links.t/30timeout.t: 25/25 on JVM and interpreter.t/32remove.t: 3/3 on JVM and interpreter.run/fresh_perl.t: test 75 passes on JVM and with the interpreterforced globally; the default JVM result is restored to 73/91 with the same
18 historical failures.