dicej requested alexcrichton for a review on PR #14555.
dicej opened PR #14555 from dicej:fix-14504 to bytecodealliance:main:
Instead of deleting any outstanding task groups when trapping, we now just record that we've notified the task hook so we don't do it again if and when the group's ref count goes to zero.
Fixes #14504
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
dicej requested wasmtime-core-reviewers for a review on PR #14555.
:memo: alexcrichton submitted PR review:
I'm a bit confused by how this works -- the
finishedfield is never set totruewhile the groups are in the table, except when the store is torn down. Was this a problem where during teardown the same group was deleted twice? If so could that be solved by reordering some teardown?
:speech_balloon: alexcrichton created PR review comment:
leftover debugging?
dicej updated PR #14555.
I'm a bit confused by how this works -- the
finishedfield is never set totruewhile the groups are in the table, except when the store is torn down. Was this a problem where during teardown the same group was deleted twice? If so could that be solved by reordering some teardown?
clean_up_task_groupsis called in two places: when a store is poisoned due to a trap and when it is disposed. In either case, the may be other cleanup after that call completes (e.g. gracefully disposing of fibers, etc.) which may cause guest and/or host tasks to be disposed, in which case we may try to look up the task group for those tasks to dispose it, but sinceclean_up_task_groupshad already deleted the group, we errored, and that error was escalated to a panic inSignalOnDrop::drop.
alexcrichton commented on PR #14555:
Do we need to run this on
set_trapped? Would it be possible to only run this on store teardown?
github-actions[bot] added the label wasmtime:api on PR #14555.
Do we need to run this on
set_trapped? Would it be possible to only run this on store teardown?No, we don't have to; I figured it would be best to do it promptly, but I'd be fine with only doing it on store teardown. And note that we'd have to make sure it's pretty much the last thing we do on store teardown if we want to delete any task groups before their reference counts go to zero; otherwise, we'll risk hitting this issue again.
alexcrichton commented on PR #14555:
I think that'd be best to implement yeah, I found it pretty surprising that
set_trappedalso had a side effect of running arbitrary embedder code
dicej updated PR #14555.
@alexcrichton I've applied your feedback and rebased onto
main.
:thumbs_up: alexcrichton submitted PR review.
dicej updated PR #14555.
dicej has enabled auto merge for PR #14555.
dicej added PR #14555 fix over-eager deletion of task groups on trap to the merge queue.
:check: dicej merged PR #14555.
dicej removed PR #14555 fix over-eager deletion of task groups on trap from the merge queue.
Last updated: Oct 11 2026 at 04:10 UTC