GOOS=js GOARCH=wasm go run fails? (panic: newosproc: not implemented)

Hi,

We’re developing a glue layer to unify GopherJS and Go’s Wasm targetting, and we encountered unfamiliar errors on TravisCI. Does anyone know what it is?

https://travis-ci.org/gopherjs/gopherwasm/builds/474950689

$ PATH=$(go env GOROOT)/misc/wasm:$PATH GOOS=js GOARCH=wasm go test github.com/gopherjs/gopherwasm/js/...

go: finding github.com/gopherjs/gopherwasm v1.0.2-0.20190103094518-b38746756334

panic: newosproc: not implemented

fatal error: panic on system stack

runtime stack:

runtime.throw(0x46b8f, 0x15)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/panic.go:608 +0x6

panic(0x1c200, 0x5e950)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/panic.go:451 +0x69

runtime.newosproc(...)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/os_js.go:116

runtime.newm1(0xc042000)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:1940 +0x14

runtime.newm(0x4c2a8, 0xc02c500)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:1919 +0xb

runtime.startm(0x0, 0x100000001)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:2066 +0x19

runtime.wakep()

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:2147 +0x4

runtime.newproc1(0x4c1a8, 0xc03c778, 0x0, 0xc000180, 0x11e40002)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:3414 +0x38

runtime.newproc.func1()

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:3309 +0x2

runtime.systemstack(0x1f3530)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/asm_wasm.s:171 +0x2

runtime.mstart()

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:1229

goroutine 1 [running]:

runtime.systemstack_switch()

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/asm_wasm.s:182 fp=0xc03c728 sp=0xc03c720 pc=0x13810000

runtime.newproc(0x0, 0x4c1a8)

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:3308 +0x2 fp=0xc03c768 sp=0xc03c728 pc=0x12360002

runtime.init.3()

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:240 +0x2 fp=0xc03c780 sp=0xc03c768 pc=0x11e40002

runtime.init()

<autogenerated>:1 +0x19 fp=0xc03c7a0 sp=0xc03c780 pc=0x137a0019

runtime.main()

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/proc.go:147 +0x9 fp=0xc03c7e0 sp=0xc03c7a0 pc=0x11e20009

runtime.goexit()

/home/travis/.gimme/versions/go1.11.linux.amd64/src/runtime/asm_wasm.s:425 +0x1 fp=0xc03c7e8 sp=0xc03c7e0 pc=0x13a70001

FAIL github.com/gopherjs/gopherwasm/js 2.424s

The command "PATH=$(go env GOROOT)/misc/wasm:$PATH GOOS=js GOARCH=wasm go test github.com/gopherjs/gopherwasm/js/..." exited with 1.

Thanks,

1 Like

It looks like a function is getting called that uses newosproc, which isn’t implemented for GOOS=js.

Based on that, I’d expect running GOOS=js GOARCH=wasm go test github.com/gopherjs/gopherwasm/js/... on your own computer to have the same error.

This error doesn’t happen on my machine.

Additionally, this error doesn’t happen with downloaded Go.

https://travis-ci.org/gopherjs/gopherwasm/builds/474981569

I was wondering what is the difference between the pre-installed Go and the original Go.

That’s a good question — “pre-installed” is actually installed using gimme to download the version of Go requested.

If you install a copy of go 1.11 using gimme 1.11 on your system, do the tests fail?

Hmm, local gimme-go succeeded to run the test :thinking:

$ gimme 1.11
$ GIMME_GO=~/.gimme/versions/go1.11.darwin.amd64/bin/go
$ cd ./gopherwasm/
$ PATH=$($GIMME_GO env GOROOT)/misc/wasm:$PATH GOOS=js GOARCH=wasm $GIMME_GO test github.com/gopherjs/gopherwasm/js/...
ok      github.com/gopherjs/gopherwasm/js       0.646s

I’ve run into what I believe is this same issue. See https://travis-ci.org/pions/webrtc/builds/505476145#L1136. I am able to run the tests on my local machine just fine.

Is there any update here? Maybe a workaround I can use?

I was able to find a workaround, which is pretty similar to the workaround used in gopherwasm.

See this commit: https://github.com/pions/webrtc/pull/504/commits/492bce782a07b645c72f74969018bc48ce637b6a

It basically involves skipping the default installation step for Go 1.12 and installing it manually instead.

Any updates?

I’m getting the same error on a minimal example.

$ GOOS=js GOARCH=wasm go test -v -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec"
panic: newosproc: not implemented
fatal error: panic on system stack

https://travis-ci.org/norunners/vert/builds/540168959