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_bugscould 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.
fitzgen added the wasm-proposal:component-model-async label to Issue #14241.
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_fiberandrun_on_workerhold them in a small RAII guard that disposes of them through the store. Each case has a unit test that aborts on currentmainand passes with the change.Thanks @dicej for writing this up with a clear direction, and @alexcrichton for spotting the pattern while reviewing #14146.
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, andresume_fiberandrun_on_workerhold them in a small RAII guard that disposes of them through the store. Each case has a unit test that aborts on currentmainand passes with the change.Thanks @dicej for writing this up with a clear direction, and @alexcrichton for spotting the pattern while reviewing #14146.
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, andresume_fiberandrun_on_workerhold them in a small RAII guard that disposes of them through the store. Each case has a unit test that aborts on currentmainand 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