Skip to content

Allow Async Stores with Fuel to Run Forever#2927

Closed
theduke wants to merge 1 commit into
bytecodealliance:mainfrom
theduke:async-yield-forever
Closed

Allow Async Stores with Fuel to Run Forever#2927
theduke wants to merge 1 commit into
bytecodealliance:mainfrom
theduke:async-yield-forever

Conversation

@theduke
Copy link
Copy Markdown
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.
@theduke theduke force-pushed the async-yield-forever branch from 0115897 to abb3978 Compare May 22, 2021 17:09
@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
Copy Markdown

Subscribe to Label Action

cc @peterhuene

Details 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
Copy Markdown
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