jellevandenhooff opened PR #12632 from jellevandenhooff:fix-on-complete-after-cancel to bytecodealliance:main:
While working on a program with many outgoing DNS requests that also got cancelled I ran into a race with subtask management:
crates/wasmtime/src/runtime/component/concurrent.rs:5108:37: called `Result::unwrap()` on an `Err` value: NotPresentThe included reproducing test fails before the fix and works after.
Code and commit message by Claude. It looks sane to me, but I am not sure about eating the error in the branch; please consider if this makes sense. If the commit message is too long I am happy to rewrite it human-style.
jellevandenhooff requested pchickey for a review on PR #12632.
jellevandenhooff requested wasmtime-core-reviewers for a review on PR #12632.
github-actions[bot] added the label wasmtime:api on PR #12632.
jellevandenhooff updated PR #12632.
jellevandenhooff updated PR #12632.
jellevandenhooff commented on PR #12632:
Okay, then ran into a similar but related issue where a cancelled task's on_complete handler was able to steal a replacement task's on_complete. The test is kind of gnarly and I am concerned it's not deterministic. What it tries to show is that:
- task A would run
- task A gets cancelled
- task B would run, with task A's original handle
- task A's on_complete would run... and signal success to what is now task B's handle
- task B's on_complete would never run
- now the guest is very confused because B's results are garbage
The epoch fix seems clean, but I am sure there might be other approaches. Without the fixes in either commit both tests fail.
Last updated: Feb 24 2026 at 04:36 UTC