Stream: git-wasmtime

Topic: wasmtime / PR #15200 Fix/concurrent defer caller completion


view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 15:22):

GamePad64 opened PR #15200 from GamePad64:fix/concurrent-defer-caller-completion to bytecodealliance:main:

Found in the wild: a Servo-based renderer component (web page →
markdown) running ~15 cooperative guest threads under wasip3, driven by
repeated calls into one component instance. Within ten cold runs the
second call into the instance stopped returning.

Two scheduler defects, two commits. They manifest the same way (the
instance's do_not_enter latch stays set and every later call is
refused) but have independent triggers. Both were found and verified on
v50.0.1, where concurrent.rs still lived at src/runtime/component/;
this PR is hand-ported to main, where the file is
crates/wasmtime/src/runtime/component/concurrent.rs

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 15:22):

GamePad64 removed the review request for wasmtime-core-reviewers from PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 15:22):

GamePad64 requested pchickey for a review on PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 15:22):

GamePad64 requested wasmtime-core-reviewers for a review on PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 15:26):

GamePad64 updated PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 16:00):

GamePad64 updated PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 16:01):

GamePad64 edited PR #15200:

Found in the wild: a Servo-based renderer component (web page → markdown) running ~15 cooperative guest threads under wasip3, driven by repeated calls into one component instance. Within ten cold runs the second call into the instance stopped returning: the instance's do_not_enter latch stayed set and every later call was refused. Two scheduler defects with independent triggers, two commits.

Commit 1 — poll_until completed the caller future as soon as it polled Ready, even with work items queued and in-flight ack tasks unpolled. The caller returns, the ack task never gets polled, the guest fiber never resumes, exit_instance never runs. Now the caller future is polled at most once per pass; if it's ready while a switch item or high-priority work is pending, completion is deferred until the urgent queues are empty and ConcurrentState::futures has fully drained.

Commit 2 — a task returning Exit leaves stale ResumeThread/GuestCall items in the queues and switch slots; resuming one runs guest code past the task's end and strands a fiber on thread.suspend. On exit, both queues are retain-filtered and the switch slots cleared, scoped to the exiting thread — a task can have sibling threads still live (e.g. a thread.new child that hasn't run yet), and purging the whole task's items deadlocks the event loop waiting for a task.return that never happens. ResumeFiber items are left alone: dropping a never-started StoreFiber via retain would trip the dispose assertion in Drop.

Both fixes were found and verified on v50.0.1 and hand-ported to main (the file moved from src/runtime/component/ to crates/wasmtime/src/runtime/component/). Commit 2's scope was corrected from task to thread after task-deletion.wast caught it in CI.

Testing: with both fixes, sequential second calls into one instance complete; a full render matrix and 10x single-call runs are green through a real host runtime. Before, the second call wedged within ten runs. No test added to the suite: the trigger needs a ~160 MB component; happy to shrink it with guidance.

@alexcrichton

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2026 at 18:44):

github-actions[bot] added the label wasmtime:api on PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 14:32):

alexcrichton removed the review request for pchickey from PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 14:32):

alexcrichton requested alexcrichton for a review on PR #15200.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 15:04):

alexcrichton commented on PR #15200:

A few requests for this:

For the first issue I think we've got a few possibly related issues to poll_until and starvation of other things in the event loop, so I'd ideally want to spend a bit more time thinking about that. Would it make sense to split apart the two issues being fixed here into two separate PRs?


Last updated: Nov 19 2026 at 20:05 UTC