hajimehoshi / wasmserve

An HTTP server for testing Wasm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sometimes WSL cannot run this application correctly

slimsag opened this issue · comments

Sometimes wasmserve does not work with WSL (Windows Subsystem for Linux), other times it does (depends on the specific program being served with wasmserve).

This is a bug in WSL and not wasmserve. I am filing this issue here for visibility so that if others run into the same problem, they know what the cause is. To fix, you can either not use WSL (which works) or try an insiders version of WSL (I haven't so I cannot confirm if that fixes it).

The issue appears as follows:

Chrome will report that it fails to fetch the wasm binary due to a content length mismatch:

(index):4 GET http://localhost:8080/main.wasm net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)

One such case where this is known to occur is in https://github.com/gopherjs/vecty (just install wasmserve under Ubuntu WSL, cd example/markdown && wasmserve).

OS details:

image

From evidence you’ve observed, can you know if this is definitely a bug in WSL, or is it still possible it’s some other root cause that happens to trigger on WSL?

Apologies for the delayed response, definitely a bug in WSL though. It is due to the way WSL reimplements Linux syscalls in a not-completely-compliant way in some cases (bugs in WSL). I think this may be solved in WSL 2 but I haven't tried it yet as it required special installation at the time I filed this issue.

Note there are many other bug reports on the WSL issue tracker like this of other applications written in Node.JS, and many other languages similarly being unable to run or having weird effects with socket code.