bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
15.2k stars 1.28k forks source link

`wasmtime serve` can't run components requiring >10MB of memory by default #8846

Closed dicej closed 3 months ago

dicej commented 3 months ago

Since wasmtime serve was switched to using the pooling allocator, which defaults to a memory limit of 10MB, components built with e.g. componentize-py or componentize-dotnet will no longer run by default. Also, since there is currently no CLI option to override that memory limit, the only workaround is to disable the pooling allocator entirely using wasmtime serve -O pooling-allocator=n.

I propose that we address this with the following changes:

dicej commented 3 months ago

See also https://github.com/bytecodealliance/wasmtime/issues/8504 and https://github.com/bytecodealliance/componentize-py/issues/94

dicej commented 3 months ago

Also, (mainly to help search engines find this issue) this is the kind of error message you get: Error: memory index 0 has a minimum page size of 223 which exceeds the limit of 160

alexcrichton commented 3 months ago

Can you test whether -Opooling-max-memory-size=N enables running these components? Sorry I keep meaning to raise the limit here and keep forgetting, but I also want to confirm orthogonally that this option works since that's what it's supposed to do

dicej commented 3 months ago
 $ wasmtime --version
wasmtime-cli 21.0.1 (cedf9aa0f 2024-05-22)
 $ wasmtime serve -Opooling-max-memory-size=160 -S cli target/component.wasm
error: unknown -O / --optimize option: pooling-max-memory-size

Maybe that's new on main?

alexcrichton commented 3 months ago

I think that might be Wasmtime 21+, what version do you have for that?

dicej commented 3 months ago

Sorry, just edited the comment; it's 21.0.1

alexcrichton commented 3 months ago

Oh sorry, for some reason I had Wasmtime 22 installed instead of the 21 version, which explains this!