Skip to content

Conversation

@fitzgen
Copy link
Member

@fitzgen fitzgen commented Jan 23, 2026

Store::new is 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 a Result is a
non-starter -- it would cause way too much pain. So instead we define
Store::try_new which returns a Result and make Store::new call and unwrap
that new constructor.

Part of #12069

Depends on

@fitzgen fitzgen requested review from a team as code owners January 23, 2026 20:43
@fitzgen fitzgen requested review from alexcrichton and removed request for a team January 23, 2026 20:43
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@github-actions github-actions bot added fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself labels Jan 23, 2026
@github-actions
Copy link

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 .github/subscribe-to-label.json configuration file.

Learn more.

@fitzgen fitzgen force-pushed the handle-oom-in-store-new branch from e119b58 to 8d5daa1 Compare January 23, 2026 22:52
@fitzgen fitzgen requested a review from a team as a code owner January 23, 2026 22:52
@fitzgen fitzgen requested review from cfallin and removed request for a team January 23, 2026 22:52
@fitzgen fitzgen enabled auto-merge January 23, 2026 22:53
@fitzgen fitzgen added this pull request to the merge queue Jan 23, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 23, 2026
@alexcrichton
Copy link
Member

@fitzgen oh to resolve that, you'll need to set Config::concurrency_support(false) after my recent refactoring to avoid allocating a FuturesUnordered

@github-actions github-actions bot added the winch Winch issues or pull requests label Jan 24, 2026
@github-actions
Copy link

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 .github/subscribe-to-label.json configuration file.

Learn more.

`Store::new` is 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 a `Result` is a
non-starter -- it would cause way too much pain. So instead we define
`Store::try_new` which returns a `Result` and make `Store::new` call and unwrap
that new constructor.

Part of bytecodealliance#12069
@fitzgen fitzgen force-pushed the handle-oom-in-store-new branch from 8d5daa1 to 948deef Compare January 26, 2026 19:22
@fitzgen fitzgen enabled auto-merge January 26, 2026 19:22
@fitzgen fitzgen added this pull request to the merge queue Jan 26, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 26, 2026
* Introduce `wasmtime::Store::try_new`, which handles OOM

`Store::new` is 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 a `Result` is a
non-starter -- it would cause way too much pain. So instead we define
`Store::try_new` which returns a `Result` and make `Store::new` call and unwrap
that new constructor.

Part of #12069

* update disas tests and fix winch

* Disable concurrency support in `Store::try_new` OOM test

* Add attributes that were lost in rebase
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 26, 2026
@fitzgen fitzgen added this pull request to the merge queue Jan 26, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 26, 2026
* Introduce `wasmtime::Store::try_new`, which handles OOM

`Store::new` is 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 a `Result` is a
non-starter -- it would cause way too much pain. So instead we define
`Store::try_new` which returns a `Result` and make `Store::new` call and unwrap
that new constructor.

Part of #12069

* update disas tests and fix winch

* Disable concurrency support in `Store::try_new` OOM test

* Add attributes that were lost in rebase
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 26, 2026
@fitzgen fitzgen added this pull request to the merge queue Jan 27, 2026
Merged via the queue into bytecodealliance:main with commit a465eab Jan 27, 2026
45 checks passed
@fitzgen fitzgen deleted the handle-oom-in-store-new branch January 27, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself winch Winch issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants