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

Resource limits #33

Open
oli-cosmian opened this issue Jun 16, 2020 · 3 comments
Open

Resource limits #33

oli-cosmian opened this issue Jun 16, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@oli-cosmian
Copy link

Once an execution is started, as a caller I have no control over the amount of memory and CPU time that is being used. Do you think it would be reasonable to

  • allow setting hard limits that will make additional allocations fail
  • stop the execution after a certain number of instructions?

The execution limit could potentially be made possible without any such limit existing in the engine by exposing more internal api so instead of just invoking invoke and waiting for the result, some API for driving each step could be exposed.

@rhysd
Copy link
Owner

rhysd commented Jun 17, 2020

allow setting hard limits that will make additional allocations fail

I think this is reasonable since for example JVM has this functionality. Current wain implementation tries to use memory until hitting bad alloc. But some use case would want to limit memory usage in some restricted environment.

stop the execution after a certain number of instructions?

Does it mean steps? This doesn't sound very useful for me since I'm not able to come up with actual use case.

Currently wain is under development as I wrote in README.md. The current main goal is passing all official spec tests. After reaching the milestone, I think we can start to consider some functionalities like memory usage limit.

@rhysd rhysd added the enhancement New feature or request label Jun 17, 2020
@oli-cosmian
Copy link
Author

Does it mean steps? This doesn't sound very useful for me since I'm not able to come up with actual use case.

Our use case would be to be able to stop wasm programs that got stuck in infinite loops, or even just super long running programs. I think it would also work if there were some way to tell the engine to shut down even though it still has more wasm to process. This way if the engine is running in a thread, another thread could tell it to safely shut down.

@rhysd
Copy link
Owner

rhysd commented Jun 19, 2020

I see. It would be useful to have execution steps limit and/or timeout.

I'll keep this issue open to consider the functionality in the future. Thank you for the point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants