Stream: git-wasmtime

Topic: wasmtime / Issue #2627 Naive usage of wastime rust crate ...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 14:27):

hjfreyer opened Issue #2627:

This may well just be me holding the crate wrong, but my application keeps using more and more memory every time I create and execute an instance.

I have a wasm32-wasi Rust binary that I want to run in a wasmtime sandbox. The binary's main() reads some data from stdin, writes it to stdout, and exits. I want each execution of the binary to be in its own independent sandbox, and I want to minimize latency. As such, I keep an Engine and a Module around between executions but drop the Instance, Store, etc. Or at least, I drop the Rust _values_, but it seems that the memory doesn't actually get freed.

Here's my code: https://github.com/hjfreyer/pictophone-be/blob/09bbe890c5fa8387d3e590209d7231ce48b130e4/server/src/runner.rs#L34

Is this a bug? Am I doing it wrong? I'm using version 0.22.0 of the wasmtime, wasmtime-wasi, and wasi-common crates.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 01 2021 at 15:08):

alexcrichton commented on Issue #2627:

Thanks for the report! What you're doing looks correct, but I believe that this is a bug in Wasmtime. I believe https://github.com/bytecodealliance/wasmtime/pull/2017 addresses the problem, so I'll take another look at landing that.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 02 2021 at 13:35):

hjfreyer commented on Issue #2627:

Confirmed that that fixed it! Yay!

How can I track when the change lands and I can get off of main?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 02 2021 at 13:35):

hjfreyer edited a comment on Issue #2627:

Confirmed that that fixed it! Yay! Thank you!

How can I track when the change lands and I can get off of main?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 02 2021 at 15:18):

alexcrichton commented on Issue #2627:

Ok thanks for confirming! I'd recommend following the releases of this repository, so you'll get a notification when we publish the next release.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 02 2021 at 15:18):

alexcrichton closed Issue #2627:

This may well just be me holding the crate wrong, but my application keeps using more and more memory every time I create and execute an instance.

I have a wasm32-wasi Rust binary that I want to run in a wasmtime sandbox. The binary's main() reads some data from stdin, writes it to stdout, and exits. I want each execution of the binary to be in its own independent sandbox, and I want to minimize latency. As such, I keep an Engine and a Module around between executions but drop the Instance, Store, etc. Or at least, I drop the Rust _values_, but it seems that the memory doesn't actually get freed.

Here's my code: https://github.com/hjfreyer/pictophone-be/blob/09bbe890c5fa8387d3e590209d7231ce48b130e4/server/src/runner.rs#L34

Is this a bug? Am I doing it wrong? I'm using version 0.22.0 of the wasmtime, wasmtime-wasi, and wasi-common crates.


Last updated: Dec 23 2024 at 12:05 UTC