Stream: git-wasmtime

Topic: wasmtime / issue #14241 Ensure fibers are always disposed...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 31 2026 at 14:46):

dicej opened issue #14241:

This module is responsible for wrangling fibers in various contexts (i.e. suspending, resuming, attaching them to waitable sets, etc.). That gets tricky when we need to move a fiber from one store-based owner to another, during which assertion failures, traps, or bail_bugs could happen such that the fiber is dropped before it has been put back into the store. That's a hazard because dropping a fiber which hasn't been allowed to exit (which requires exclusive access to a store) will itself panic, which can escalate e.g. a trap to a full blown crash.

As long as every fiber is owned by the store somehow, we're safe, because when the store is dropped, all its fibers are disposed of gracefully (assuming we've remembered to check all the places in the store where fibers can be kept). Likewise, we can wrap a fiber in an RAII object in combination with a store to ensure it is disposed of properly when the RAII object is dropped. Any time a fiber is not protected in one of those two ways, though, it's a hazard, so we should audit the code for such cases and fix them.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2026 at 16:57):

fitzgen added the wasm-proposal:component-model-async label to Issue #14241.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2026 at 10:50):

Byte-Naut commented on issue #14241:

#14385 should fix this. It follows the approach outlined above: fibers stay in their store-owned slot until any fallible lookups are done, and resume_fiber and run_on_worker hold them in a small RAII guard that disposes of them through the store. Each case has a unit test that aborts on current main and passes with the change.

Thanks @dicej for writing this up with a clear direction, and @alexcrichton for spotting the pattern while reviewing #14146.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 25 2026 at 06:12):

Byte-Naut edited a comment on issue #14241:

Update: superseded by #14418 , which keeps fibers in their thread state instead of guarding each handoff, per @alexcrichton's suggestion in #14385.

#14385 should fix this. It follows the approach outlined above: fibers stay in their store-owned slot until any fallible lookups are done, and resume_fiber and run_on_worker hold them in a small RAII guard that disposes of them through the store. Each case has a unit test that aborts on current main and passes with the change.

Thanks @dicej for writing this up with a clear direction, and @alexcrichton for spotting the pattern while reviewing #14146.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 25 2026 at 06:18):

Byte-Naut edited a comment on issue #14241:

Update: superseded by #14418, which keeps fibers in their thread state instead of guarding each handoff, per @alexcrichton's suggestion in #14385.

#14385 should fix this. It follows the approach outlined above: fibers stay in their store-owned slot until any fallible lookups are done, and resume_fiber and run_on_worker hold them in a small RAII guard that disposes of them through the store. Each case has a unit test that aborts on current main and passes with the change.

Thanks @dicej for writing this up with a clear direction, and @alexcrichton for spotting the pattern while reviewing #14146.


Last updated: Oct 11 2026 at 02:20 UTC