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

wasmedge: sending UDP datagrams fails with Invalid argument error #34

Open
marten-seemann opened this issue May 16, 2024 · 1 comment
Open
Assignees
Labels
question Further information is requested

Comments

@marten-seemann
Copy link

Hi guys, author of quic-go here 👋

I'm trying to compile a simple quic-go server and client to WASM, and I'm running into the following problem: sending UDP datagrams fails with an Invalid argument error.

I managed to distill it down to this simple example:

func main() {
	conn, err := wasip1.ListenPacket("udp", "127.0.0.1:6121")
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	if _, err := conn.WriteTo([]byte("foobar"), &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 1234}); err != nil {
		log.Fatalf("failed to write: %v", err)
	}
}

The above code works when using wasirun, but it fails with wasmedge.

Apologies if I'm missing something obvious, or if I opened the issue in the wrong repo. I'm pretty new to WASM.

@marten-seemann marten-seemann changed the title sending UDP datagrams fails: Invalid argument wasmedge: sending UDP datagrams fails with Invalid argument error May 16, 2024
@achille-roussel
Copy link
Contributor

I think your code is correct, and if it works with wasirun there's at least some combination of guest+host that's functional!

A couple of things that may cause the issue:

  • wasmedge has changed their ABI and we need to adapt wasi-go
  • there are flags we use in some socket calls that aren't supported by wasmedge

I'd recommend trying to run with some kind of debug logs enabled to trace the host function calls that the program makes, this could provide insight into where things are breaking. For example, with wasirun, this can be done with the --trace option.

I hope this is useful!

@achille-roussel achille-roussel self-assigned this May 16, 2024
@achille-roussel achille-roussel added the question Further information is requested label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants