Skip to content

fix(io): return a file slot without spawning from a stream's drop - #157

Merged
lexoliu merged 1 commit into
mainfrom
fix/detached-tasks-at-drop
Nov 11, 2026
Merged

lexoliu merged 1 commit into
mainfrom
fix/detached-tasks-at-drop

Conversation

@lexoliu

@lexoliu lexoliu commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

A compio stream that held a registered file slot gave it back by spawning a task from File::drop. When a runtime drops, compio clears its queue by dropping each unfinished task's future. A stream dropped that way spawned into the queue being cleared, and compio-executor's inner.map.is_empty() assertion fired.

The task that installs the slot now keeps it for the stream's whole life. Dropping the stream marks it gone and wakes that task, which returns the slot, so drop no longer spawns. While the runtime runs, slots are still always returned. If the runtime drops first, the slot goes with the ring. Zero-copy sends are unchanged: compio keeps a cancelled op's buffers until the kernel completes it.

The new test a_runtime_drops_while_a_task_holds_a_stream_with_a_slot fails on main with that assertion and passes with this change. On Linux the io and h1 suites pass. zenwave's compio native_backend_tests passed 19 of 19 against this branch, where main fails 12 at the same assertion.

Closes #156

Dropping a stream that held a registered file slot spawned a task to give
the slot back. A compio runtime being dropped clears its executor by
dropping every unfinished task's future, so a stream owned by such a task
spawned onto the queue being drained, tripping compio-executor's
`inner.map.is_empty()` assertion.

The task that takes the slot now keeps it: it waits for the stream to go
and gives the slot back then, and dropping the stream only wakes it. A
keeper dropped with its runtime leaves the slot to the ring's teardown.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@lexoliu
lexoliu merged commit b70ceed into main Nov 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compio: work still queued when a runtime drops fails compio-executor's drop assertion

2 participants