Skip to content

runtime: deadlock detection fails with only one goroutine #3342

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
remyoudompheng opened this issue Mar 17, 2012 · 12 comments
Closed

runtime: deadlock detection fails with only one goroutine #3342

remyoudompheng opened this issue Mar 17, 2012 · 12 comments
Milestone

Comments

@remyoudompheng
Copy link
Contributor

What steps will reproduce the problem?
1. Compile and run

package main

var s = make(chan int)

func do() { s <- 1 }

func main() {
  // go do()
  <-s
  <-s
}

What is the expected output? What do you see instead?

Expected:
throw: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
main.main()
    /tmp/main.go:10 +0x59

goroutine 2 [syscall]:
created by runtime.main
    /opt/remy/go/src/pkg/runtime/proc.c:221

Got:
<nothing>
@remyoudompheng
Copy link
Contributor Author

Comment 1:

The deadlock is detected in the following cases:
- go do() is uncommented
- GOMAXPROCS > 1

@dsymonds
Copy link
Contributor

Comment 2:

Sounds like a small oversight.

Labels changed: added priority-go1, go1-must, removed priority-triage.

@ianlancetaylor
Copy link
Member

Comment 3:

The fix is http://golang.org/cl/5844051/ .  It may not go into Go 1.

Status changed to Started.

@rsc
Copy link
Contributor

rsc commented Mar 26, 2012

Comment 4:

Let's wait until after Go 1.

@rsc
Copy link
Contributor

rsc commented Mar 26, 2012

Comment 5:

This would have been a Go 1 must two weeks ago, but now I'm not willing to touch that
code before Go 1.

Labels changed: added priority-later, removed priority-go1, go1-must.

@rsc
Copy link
Contributor

rsc commented Mar 27, 2012

Comment 6:

This issue was closed by revision 84bb254.

Status changed to Fixed.

@mikioh
Copy link
Contributor

mikioh commented Mar 27, 2012

Comment 7:

This issue was closed by revision 4c2614c.

@mikioh
Copy link
Contributor

mikioh commented Mar 27, 2012

Comment 8:

Status changed to New.

@rsc
Copy link
Contributor

rsc commented Mar 27, 2012

Comment 9:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 10:

Labels changed: added go1.1.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 11:

Labels changed: added size-l.

@rsc
Copy link
Contributor

rsc commented Feb 15, 2013

Comment 12:

This seems to be working now. At least the example in comment #1 works. Please reopen if
you have a different test case.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants