Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add webassembly-micro-runtime support #337

Open
squillace opened this issue Sep 26, 2023 · 5 comments
Open

Add webassembly-micro-runtime support #337

squillace opened this issue Sep 26, 2023 · 5 comments

Comments

@squillace
Copy link

Currently, there is shim support for wasmtime, wasmedge, and wasmer thanks to contributors from around the world. I'd like to propose that we add support for the https://github.com/bytecodealliance/wasm-micro-runtime to ensure wide coverage for runtimes in this space. Each one of these runtime specializes in something important that people should have access to anywhere they want to use K8s and WebAssembly.

@0xE282B0
Copy link
Contributor

Ok, we can do that. I already started with an executor some time ago: https://github.com/0xE282B0/runwasi-youki/tree/main/crates/youki-wamr-executor

@0xE282B0
Copy link
Contributor

0xE282B0 commented Sep 27, 2023

Ok, I remember where the problems were 😅.

Rust Crate

There is a wamr-sys crate by @rahul-thakoor on crates.io.
Unfortunately it is a bit outdated, but @jturcotte forked it and updated it. However, it did not have WASI enabled, so I forked it again and enabled WASI in this repo.

The wamr-sys crate is just a bunch of rust-bindgen generated bindings. This leads to a lot of unsafe code. I put together a quick draft to outline the problems: 0xE282B0#5

Runwasi

The drafted shim contains a test case which runs the wasi-demo-app:

#[test]
fn test_exec() -> anyhow::Result<()> {
    exec("../../target/wasm32-wasi/debug/wasi-demo-app.wasm");
    Ok(())
}

This already works, it also worked in the youki executor I tried some time ago. However, it does not work in the runwasi shim, because wasm_runtime_init() fails. (probably during the initialization of the memory allocator). We could try to play with the init configuration and may get someone from the WAMR project to get some insights on that problem.

TLDR

In my opinion we would need to:

  • (Re)publish the wamr-sys crate
  • Create a wamr crate with a safe api
  • Debug why the WAMR runtime initialization fails
  • Create a PR to the runwasi project for the WAMR shim 🎉

I'm afraid that's a little more than I can spend working on open source projects. 🫣

Is there anyone with a need for WAMR containers, already?
Or is anyone interested in debugging WAMR on runwasi with libcontainer?

@Mossaka
Copy link
Member

Mossaka commented Oct 16, 2023

I want to reach out to maintainers from Wamr and asking if the community is interested in investing in this work.

@lum1n0us
Copy link

Wamr community is very eager to have volunteers to support it. Wamr team would like to provide all technical guidance beside Rust language knowledge.

@squillace
Copy link
Author

@lum1n0us do you all have insights about #337 (comment)? Is there another path or are some of those things you can help us with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants