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

syscall/js: "goroutines are asleep" error only in Node.js #32764

agnivade opened this issue Jun 25, 2019 · 1 comment


Copy link

commented Jun 25, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.4 linux/amd64

Does this issue reproduce with the latest release?


What did you do?

package main

import (

func main() {
	var cb js.Func
	cb = js.FuncOf(func(this js.Value, args []js.Value) interface{} {
		fmt.Println("cb called")
		return nil
	js.Global().Set("callme", cb)
	done := make(chan struct{})
	fmt.Println("waiting for callback")

I ran this in both browser and Node.js.

What did you expect to see?

I expect in both cases, for the program to wait indefinitely.

What did you see instead?

In works fine in browser:

$#go_js_wasm_exec is set to wasmbrowsertest
$GOOS=js GOARCH=wasm go run foo.go 
waiting for callback
^Csignal: interrupt

But fails in Node.js

$PATH=/usr/local/go/misc/wasm:$PATH GOOS=js GOARCH=wasm go run foo.go 
waiting for callback
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
	/home/agniva/play/go/src/foo.go:24 +0xb
exit status 2

Is this expected ?

My node version is 10.2.1

/cc @neelance

I haven't tried with 1.11 because the function semantics have changed since.


This comment has been minimized.

Copy link

commented Jun 25, 2019

Thinking out loud, but presumably this incompatibility is lurking somewhere in wasm_exec.js? If it's working in the browser, I assume that means the generated WASM is fine, and that it's the translation layer that's doing something wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.