wasmtime
wasmtime copied to clipboard
c-api: allow top level API to set `wasm-timeout`
Feature
Hi Folks,
Thanks for creating this wonderful runtime. I was wondering if there are any plans to expose wasm-timeout
at c-api
level ?
It will allow users of c-api
to timout the runtime as per the needs.
Benefit
Provides a timout
knob for c-api
users, giving more control to the end users.
Implementation
Maybe creating a top level interface and make timeout part of wasi_config_t
could work ?
I can understand that more than enough issues are already there and upstream maintainers are already busy, If the idea looks good I'd like to help by implementing this feature. :smile:
Wasmtime doesn't have a native timeout knob precisely in its embedding API, but the CLI offers a timeout option as built from other primitives in the embedding API. One mechanism for timeouts is epochs which is possible through wasmtime_engine_increment_epoch
and wasmtime_config_epoch_interruption_set
. Another option is possible through wasmtime_config_consume_fuel_set
and wasmtime_context_add_fuel
. Are you able to combine those to satisfy your embedding use case?
Wasmtime doesn't have a native timeout knob precisely in its embedding API, but the CLI offers a timeout option as built from other primitives in the embedding API. One mechanism for timeouts is epochs which is possible through
wasmtime_engine_increment_epoch
andwasmtime_config_epoch_interruption_set
. Another option is possible throughwasmtime_config_consume_fuel_set
andwasmtime_context_add_fuel
. Are you able to combine those to satisfy your embedding use case?
@alexcrichton Thanks a lot for checking this, I'll give it a try today and comment back here :)