Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Async Stores with Fuel to Run Forever #2927

Closed
wants to merge 1 commit into from

Conversation

theduke
Copy link
Contributor

@theduke theduke commented May 22, 2021

Currently there is no way to configure an async store to run forever.

A fuel injection count has to be specified, which eventually reaches 0 and
causes a trap.

This changes the OutOfGas::InjectFuel configuration to make the injection
count optional, which allows stores to run forever.

NOTE: this is obviously a breaking API change.

It would also be possible to add an additional config method.

Changes the OutOfGas::InjectFuel configuration to make the injection
count optional, which allows stores to run forever.
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label May 22, 2021
@github-actions
Copy link

Subscribe to Label Action

cc @peterhuene

This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@alexcrichton
Copy link
Member

Thanks for the PR! The original intention was that u32::max_value() would be sufficient for anyone wanting to use this, although thinking about this again now if only a small amount of fuel is injected each time then we should perhaps bump that up to u64. I think that would allow effectively infinite execution still?

Personally I think that this, if still desired instead of u64, should probably be done through a separate method which is dedicated to infinite execution instead of None silently representing that.

alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Jun 30, 2021
This commit updates the type of the amount of times to inject fuel in
the `out_of_fuel_async_yield` to `u64` instead of `u32`. This should
allow effectively infinite fuel to get injected, even if a small amount
of fuel is injected per iteration.

Closes bytecodealliance#2927
Closes bytecodealliance#3046
alexcrichton added a commit that referenced this pull request Jul 1, 2021
* Change the injection count of fuel in a store from u32 to u64

This commit updates the type of the amount of times to inject fuel in
the `out_of_fuel_async_yield` to `u64` instead of `u32`. This should
allow effectively infinite fuel to get injected, even if a small amount
of fuel is injected per iteration.

Closes #2927
Closes #3046

* Fix tokio example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants