fitzgen opened PR #12415 from fitzgen:handle-oom-in-store-new to bytecodealliance:main:
Store::newis an infallible constructor, so there is not a direct way to make
it return an error on OOM. Additionally, it is one of the most-used functions in
the Wasmtime embedder API, so changing its signature to return aResultis a
non-starter -- it would cause way too much pain. So instead we define
Store::try_newwhich returns aResultand makeStore::newcall and unwrap
that new constructor.Part of https://github.com/bytecodealliance/wasmtime/issues/12069
Depends on
fitzgen requested alexcrichton for a review on PR #12415.
fitzgen requested wasmtime-core-reviewers for a review on PR #12415.
fitzgen requested wasmtime-fuzz-reviewers for a review on PR #12415.
alexcrichton submitted PR review:
Nice :+1:
github-actions[bot] added the label fuzzing on PR #12415.
github-actions[bot] added the label wasmtime:api on PR #12415.
github-actions[bot] commented on PR #12415:
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>
fitzgen updated PR #12415.
fitzgen requested cfallin for a review on PR #12415.
fitzgen requested wasmtime-compiler-reviewers for a review on PR #12415.
fitzgen has enabled auto merge for PR #12415.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
This isn't quite sufficient, right? Doesn't the return value need to be checked for a trap?
fitzgen submitted PR review.
fitzgen created PR review comment:
The wasm-to-builtin trampoline does that, we just happen to always forward results from the builtin out of the trampoline, even if it is just the bool for whether a trap happened (which we know it didn't if the trampoline call returned to Wasm).
fitzgen submitted PR review.
fitzgen created PR review comment:
See, for example, Winch's implementation of
table.copy:
fitzgen edited PR review comment.
alexcrichton created PR review comment:
Oh right, indeed!
alexcrichton submitted PR review.
fitzgen added PR #12415 Introduce wasmtime::Store::try_new, which handles OOM to the merge queue.
github-merge-queue[bot] removed PR #12415 Introduce wasmtime::Store::try_new, which handles OOM from the merge queue.
alexcrichton commented on PR #12415:
@fitzgen oh to resolve that, you'll need to set
Config::concurrency_support(false)after my recent refactoring to avoid allocating aFuturesUnordered
github-actions[bot] added the label winch on PR #12415.
github-actions[bot] commented on PR #12415:
Subscribe to Label Action
cc @saulecabrera
<details>
This issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
- saulecabrera: winch
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
fitzgen updated PR #12415.
fitzgen has enabled auto merge for PR #12415.
fitzgen updated PR #12415.
fitzgen added PR #12415 Introduce wasmtime::Store::try_new, which handles OOM to the merge queue.
github-merge-queue[bot] removed PR #12415 Introduce wasmtime::Store::try_new, which handles OOM from the merge queue.
fitzgen added PR #12415 Introduce wasmtime::Store::try_new, which handles OOM to the merge queue.
github-merge-queue[bot] removed PR #12415 Introduce wasmtime::Store::try_new, which handles OOM from the merge queue.
fitzgen added PR #12415 Introduce wasmtime::Store::try_new, which handles OOM to the merge queue.
fitzgen merged PR #12415.
fitzgen removed PR #12415 Introduce wasmtime::Store::try_new, which handles OOM from the merge queue.
Last updated: Jan 29 2026 at 13:25 UTC