SebTardif opened PR #13977 from SebTardif:fix/gc-restore-trace-infos-on-error to bytecodealliance:main:
Summary
process_worklist_incrementtook ownership ofheap.trace_infoswithmem::takeand only restored it on the success path. Ifworklist_pop()orscan()returned an error, the temporaryVecwas dropped and the heap permanently lost its trace table for the rest of the collection.Fix
Run the increment body in a closure and always assign
self.heap.trace_infos = trace_infosafterward, whether the result isOkorErr.Testing
- Logic review of all
?exits inside the increment body (worklist_pop,heap_index,scan)- No public-API host test exercises a forced mid-increment GC error without a custom trap; the restoration is local and mechanical
Notes
Matches the Bytecode Alliance preference for small, fully understood correctness patches.
SebTardif requested pchickey for a review on PR #13977.
SebTardif requested wasmtime-core-reviewers for a review on PR #13977.
github-actions[bot] added the label wasmtime:ref-types on PR #13977.
github-actions[bot] added the label wasmtime:api on PR #13977.
github-actions[bot] commented on PR #13977:
Subscribe to Label Action
cc @fitzgen
<details>
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:ref-types"Thus the following users have been cc'd because of the following labels:
- fitzgen: wasmtime:ref-types
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:thumbs_up: fitzgen submitted PR review.
fitzgen added PR #13977 fix(gc): restore trace_infos if worklist increment fails to the merge queue.
:check: fitzgen merged PR #13977.
fitzgen removed PR #13977 fix(gc): restore trace_infos if worklist increment fails from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC