Stream: wasmtime

Topic: wasm32-wasi leak


view this post on Zulip Bailey Hayes (Jun 06 2022 at 17:43):

When a wasm function that takes and returns a list of u8 is called > 600k times we are running out of memory. I still need to setup a pure repro case of wasmtime outside of my engine.

I can't say for sure if this is in how we're using wasmtime or if there is a leak in wasmtime itself. When we compile against wasm32-unknown-unknown the leak doesn't happen. There's evidently some kind of interop problem with us when wasm32-wasi is in play.

Does anyone have a good tip for where to start investigating?

Wit:

step: function(me: s64, cell: list<u8>) -> list<u8>

Rust:

wit_bindgen_rust::export!("agent.wit");
struct Agent;

// use std::io::Cursor;
// use byteorder::{LittleEndian, ReadBytesExt};

impl agent::Agent for Agent {
    fn step(_me: i64, cell: Vec<u8>) -> Vec<u8> {
        // return first entity in cell
        cell[..16].to_vec()
    }
}

view this post on Zulip Alex Crichton (Jun 06 2022 at 18:05):

There was a similar use issue recently reported where it had to do with the linker-inserted command/reactor bits, although whether or not that's applicable here depends on the way you're compiling. Given though that it's wasi-specific it seems likely it's the same thing

Note: I'm not sure if my implementation is correct, so please correct me if my implementation or expectations are wrong. Test Case Example project is available here Steps to Reproduce Create a ...

view this post on Zulip Bailey Hayes (Jun 06 2022 at 19:25):

Thank you that does look very, very similar. I'm glad I asked!


Last updated: Oct 23 2024 at 20:03 UTC