Stream: git-wasmtime

Topic: wasmtime / issue #3772 StoreLimits maximum memory trap


view this post on Zulip Wasmtime GitHub notifications bot (Feb 07 2022 at 16:16):

mversic opened issue #3772:

Feature

I'd like to see a more meaningful message when using StoreLimits and maximum memory size is reached. Currently, it happens that when instance requests more memory than is allowed, a Trap is generated with message all fuel consumed by WebAssembly with the corresponding stack trace. I don't know what happens if fuel consumption is not enabled, it's possible it will spin indefinitely. If that's the case, this could also be a bug

Benefit

Easier debugging and error handling

view this post on Zulip Wasmtime GitHub notifications bot (Feb 07 2022 at 16:29):

alexcrichton commented on issue #3772:

This is unfortunately not always possible and is something that you'll typically need to register out-of-band rather than having first-class errors. For example the memory.grow instruction only returns -1 on failure, not an error message, so what the wasm module does when -1 is returned is entirely up to it and not something the embedder has control over. Some wasm modules may be buggy on -1 being returned, which may be the behavior you're seeing.

Otherwise though what you can do is that when the limit is exceeded you can update the state of the StoreLimiter that the limit was exceeded, and then later when building an error report the flag can be checked to indicate that the error may, but is not guaranteed to be, related to the fact that a request for more memory was denied.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2022 at 15:14):

alexcrichton commented on issue #3772:

I'm going to close this because I believe the StoreLimits are working correctly here in that after failure is signaled to a wasm module with -1 it's up to the wasm module how to handle that. The embedder can recognize that memory growth was rejected but beyond that it's up to the embedder to correlate errors.

view this post on Zulip Wasmtime GitHub notifications bot (May 20 2022 at 15:14):

alexcrichton closed issue #3772:

Feature

I'd like to see a more meaningful message when using StoreLimits and maximum memory size is reached. Currently, it happens that when instance requests more memory than is allowed, a Trap is generated with message all fuel consumed by WebAssembly with the corresponding stack trace. I don't know what happens if fuel consumption is not enabled, it's possible it will spin indefinitely. If that's the case, this could also be a bug

Benefit

Easier debugging and error handling


Last updated: Oct 23 2024 at 20:03 UTC