alexcrichton opened PR #13048 from alexcrichton:fix-decrement to bytecodealliance:main:
This commit fixes an issue during component instantiation where if instantiation failed during creation of the
Instantiatordue to OOM or if theasyncfuture was dropped the concurrent instance count in the pooling allocator would get corrupted (off-by-one). The fix here is to switch amap_errwith a manual decrement to using a value that has a
destructor to ensure that it handles both of these cases.<!--
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 ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested wasmtime-fuzz-reviewers for a review on PR #13048.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13048.
alexcrichton requested fitzgen for a review on PR #13048.
fitzgen submitted PR review.
fitzgen created PR review comment:
Instead of an
enabledflag, maybemem::forget(decrement)here? LLVM can probably keepenabledfrom being materialized at runtime, but the forget pattern seems no worse for ergonomics and guarantees that we won't need aboolflag at runtime.
github-actions[bot] added the label fuzzing on PR #13048.
github-actions[bot] added the label wasmtime:api on PR #13048.
github-actions[bot] commented on PR #13048:
Subscribe to Label Action
cc @fitzgen
<details>
This issue or pull request has been labeled: "fuzzing", "wasmtime:api"Thus the following users have been cc'd because of the following labels:
- fitzgen: fuzzing
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Personally I prefer to the
boolflag since it's otherwise in theory possible to leak memory withmem::forget. Effectively I trust LLVM's removal of theboolmore than my own ability to double-check that nothing in the dtor accidentally leaks memory.Is that ok with you as well though?
alexcrichton updated PR #13048.
fitzgen submitted PR review.
fitzgen created PR review comment:
Yeah, sounds fine.
fitzgen added PR #13048 Fix current instance count on failure during component instantiation to the merge queue.
github-merge-queue[bot] removed PR #13048 Fix current instance count on failure during component instantiation from the merge queue.
alexcrichton updated PR #13048.
alexcrichton has enabled auto merge for PR #13048.
alexcrichton added PR #13048 Fix current instance count on failure during component instantiation to the merge queue.
alexcrichton merged PR #13048.
alexcrichton removed PR #13048 Fix current instance count on failure during component instantiation from the merge queue.
Last updated: May 03 2026 at 23:15 UTC