Skip to content

calling os.Exit(0) from a gopherjs run invocation fails with "fatal error: all goroutines are asleep - deadlock!" #531

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

Closed
nullstyle opened this issue Oct 1, 2016 · 10 comments

Comments

@nullstyle
Copy link
Contributor

Here's the repro script:

package main

import (
    "fmt"
    "os"
)

func main() {
    fmt.Println("hello world")
    os.Exit(0)
}

sample results:

➜  testj git:(mithril) ✗ gopherjs run ./main.go
gopherjs: Source maps disabled. Use Node.js 4.x with source-map-support module for nice stack traces.
hello world
fatal error: all goroutines are asleep - deadlock!

This appears to be the root cause of #395 as well.

@dmitshur
Copy link
Member

dmitshur commented Oct 1, 2016

Just checking, are you familiar with https://github.com/gopherjs/gopherjs#application-lifecycle?

@nullstyle
Copy link
Contributor Author

My understanding was that only applies to the browser... gopherjs test runs using node, AFAIK.

@nullstyle
Copy link
Contributor Author

You can see the workaround I'm using presently at nullstyle@8d4d6d0

@dmitshur
Copy link
Member

dmitshur commented Oct 1, 2016

I cannot reproduce with latest version of GopherJS.

I have Node version v6.7.0 with both node-syscall and source-map-support modules installed.

Running the program above gives me:

$ node --version
v6.7.0

$ go run main.go
hello world
$ gopherjs run main.go 
hello world
$

Can you try again with both node-syscall and source-map-support modules installed? I suspect that they might make a difference.

If so, this is definitely related to #449 (see discussion about source-map-support there).

@nullstyle
Copy link
Contributor Author

after installing node-syscall, the issue no longer occurs. I didn't even know node-syscall was a thing, seems like it should be in the README. Are you open to me making a PR to add that?

Is there anyway to get node-syscall into npm?

@dmitshur
Copy link
Member

dmitshur commented Oct 1, 2016

Okay, thanks for confirming.

I didn't even know node-syscall was a thing, seems like it should be in the README.

It is in the README, in the Installation and Usage section.

https://github.com/gopherjs/gopherjs#installation-and-usage

Is there anyway to get node-syscall into npm?

I do not know much about npm.

@nullstyle
Copy link
Contributor Author

nullstyle commented Oct 1, 2016

It is in the README, in the Installation and Usage section.

IMO It's not clear that it's required to get basic behavior like gopherjs test working.

@hajimehoshi
Copy link
Member

I'm not familiar with node, and I don't know how to install node-syscall...

@hajimehoshi
Copy link
Member

Ah, I found https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md

@dmitshur
Copy link
Member

As far as I can tell, the only remaining actionable issue here was this:

IMO It's not clear that it's required to get basic behavior like gopherjs test working.

I believe that has been fixed in 33af5e0. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants