Release owned queue handles after grant completion - #131
Open
cf-rhett wants to merge 2 commits into
Open
Conversation
Terminal grant methods forgot the entire grant to bypass its default Drop behavior. With ArcBBQueue, that retained an Arc after every commit or release and kept the queue allocation alive indefinitely. Release the owned handle while preserving terminal coordination, and cover each affected method with an Arc liveness regression test.
The existing Arc-backed tests expose owned handle leaks, but the Miri script disabled leak reports. Keep the checker enabled now that the suite is leak-free so CI catches future regressions.
This was referenced Jul 31, 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.
Owned framed and stream grants call
mem::forget(self)after commit or release to suppress their defaultDropbehavior. ForArcBBQueue, that also permanently retains each clonedArcand can keep the queue allocation alive indefinitely.Stream grants now record the requested terminal amount and use their existing
Droppath for coordination. Framed grants suppress their defaultDroponly after coordination succeeds, then notify through and release the extracted queue handle. Public APIs and grant layouts are unchanged.This surfaced while investigating #130.
Miri evidence
On pristine
f212a93, removing-Zmiri-ignore-leaksmakes the pre-existingtest::arc2report the leaked 768-byteBBQueueallocation fromArcBBQueue::new_with_storageand the leaked 64-byte ring allocation fromBoxedSlice::new. The retained queue also roots notifier, waker, and Tokio task state, producing 21 leaked allocations in total.This branch removes that suppression. The exact CI entry point,
./miri.sh, passes all 14 unit tests and 2 doctests with leak checking enabled and no leak reports.Validation
./miri.shcargo test -p bbqueue --features stdcargo clippy -p bbqueue --all-targets --features std -- -D warnings