Stream: git-wasmtime

Topic: wasmtime / issue #5867 wasmtime does not allow network fu...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 16:44):

kmehant opened issue #5867:

<!-- Thanks for the bug report! -->

Description

wasmtime run --tcplisten localhost:8080 --wasm-features=all  wasm_with_network_code.wasm localhost 8080

output:

operation not implemented
wasmtime run --wasm-features=all  wasm_with_network_code.wasm localhost 8080

output:

operation not implemented

Steps to reproduce

Build Go program with the below code with wasi target

// os.Args[1] -> localhost
// os.Args[2] -> 8080
server, err := net.Listen("tcp", os.Args[1]+":"+os.Args[2])

run the wasm module with wasmtime

wasmtime run --wasm-features=all  wasm_with_network_code.wasm localhost 8080

or

wasmtime run --tcplisten localhost:8080 --wasm-features=all  wasm_with_network_code.wasm localhost 8080

Expected behavior

start a server and listen at localhost:8080 and accept requests

Actual behavior

fails with message operation not implemented

Versions and Environment

Wasmtime version or commit: wasmtime-cli 5.0.0

Operating system: Mac OS Monterey

Architecture: AMD 64

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 16:44):

kmehant labeled issue #5867:

<!-- Thanks for the bug report! -->

Description

wasmtime run --tcplisten localhost:8080 --wasm-features=all  wasm_with_network_code.wasm localhost 8080

output:

operation not implemented
wasmtime run --wasm-features=all  wasm_with_network_code.wasm localhost 8080

output:

operation not implemented

Steps to reproduce

Build Go program with the below code with wasi target

// os.Args[1] -> localhost
// os.Args[2] -> 8080
server, err := net.Listen("tcp", os.Args[1]+":"+os.Args[2])

run the wasm module with wasmtime

wasmtime run --wasm-features=all  wasm_with_network_code.wasm localhost 8080

or

wasmtime run --tcplisten localhost:8080 --wasm-features=all  wasm_with_network_code.wasm localhost 8080

Expected behavior

start a server and listen at localhost:8080 and accept requests

Actual behavior

fails with message operation not implemented

Versions and Environment

Wasmtime version or commit: wasmtime-cli 5.0.0

Operating system: Mac OS Monterey

Architecture: AMD 64

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 17:59):

pchickey commented on issue #5867:

Can you provide a wasm binary we can use to reproduce?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 18:05):

kmehant commented on issue #5867:

server.wasm.zip

@pchickey Here it is. Thanks

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 18:11):

bjorn3 commented on issue #5867:

How was the binary compiled? From what I can gather go doesn't yet support wasi. Are you using tinygo? I think tinygo doesn't support network functionality yet and throws that exact "operation not implemented" error: https://github.com/tinygo-org/tinygo/blob/0d56dee00f49bd50eb373c02c30062a75ec28f10/src/net/dial.go#L20

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

kmehant commented on issue #5867:

How was the binary compiled? From what I can gather go doesn't yet support wasi. Are you using tinygo? I think tinygo doesn't support network functionality yet and throws that exact "operation not implemented" error: https://github.com/tinygo-org/tinygo/blob/0d56dee00f49bd50eb373c02c30062a75ec28f10/src/net/dial.go#L20

@bjorn3 Ah, got it, thanks.

Are there any alternatives?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 18:21):

bjorn3 commented on issue #5867:

You could ask tinygo to add support for it. Alternatively you could try directly binding to wasi's sock_accept, but I'm not sure if tinygo allows that or puts it's own standard library in a privileged position.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 18:36):

pchickey commented on issue #5867:

I'll close this because it appears to be a tinygo issue

view this post on Zulip Wasmtime GitHub notifications bot (Feb 23 2023 at 18:36):

pchickey closed issue #5867:

<!-- Thanks for the bug report! -->

Description

wasmtime run --tcplisten localhost:8080 --wasm-features=all  wasm_with_network_code.wasm localhost 8080

output:

operation not implemented
wasmtime run --wasm-features=all  wasm_with_network_code.wasm localhost 8080

output:

operation not implemented

Steps to reproduce

Build Go program with the below code with wasi target

// os.Args[1] -> localhost
// os.Args[2] -> 8080
server, err := net.Listen("tcp", os.Args[1]+":"+os.Args[2])

run the wasm module with wasmtime

wasmtime run --wasm-features=all  wasm_with_network_code.wasm localhost 8080

or

wasmtime run --tcplisten localhost:8080 --wasm-features=all  wasm_with_network_code.wasm localhost 8080

Expected behavior

start a server and listen at localhost:8080 and accept requests

Actual behavior

fails with message operation not implemented

Versions and Environment

Wasmtime version or commit: wasmtime-cli 5.0.0

Operating system: Mac OS Monterey

Architecture: AMD 64


Last updated: Nov 22 2024 at 16:03 UTC