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

Program deadlocks after a call to GOMAXPROCS() #1715

Closed
dvyukov opened this issue Apr 18, 2011 · 6 comments
Closed

Program deadlocks after a call to GOMAXPROCS() #1715

dvyukov opened this issue Apr 18, 2011 · 6 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Apr 18, 2011

What steps will reproduce the problem?

func perpetuumMobile() {
  go perpetuumMobile()
}

func TestStopTheWorldDeadlock(t *testing.T) {
    runtime.GOMAXPROCS(3)
    compl := make(chan int, 1)
    go func() {
        for i := 0; i != 1000; i += 1 {
            runtime.GC()
        }
        compl <- 0
    }()
    go func() {
        for i := 0; i != 1000; i += 1 {
            runtime.GOMAXPROCS(3)
        }
    }()
    go perpetuumMobile();
    <- compl
}

What is the expected output?
Program does not deadlock.

What do you see instead?
Program deadlocks.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
linux

Which revision are you using?  (hg identify)
6994a5f47fb9+ tip
@dvyukov
Copy link
Member Author

dvyukov commented Apr 18, 2011

Comment 1:

Just in case I'm preparing CL for the bug.

@dvyukov
Copy link
Member Author

dvyukov commented Apr 18, 2011

Comment 2:

Here is the fix:
http://golang.org/cl/4434053/

@alberts
Copy link
Contributor

alberts commented Apr 18, 2011

Comment 3:

This explains issue #1701 too. My program was logging the value of GOMAXPROCS.

@dvyukov
Copy link
Member Author

dvyukov commented Apr 18, 2011

Comment 4:

Yeah, the runtime re-setups maxprocs on query. Try to apply to the CL, and check as to
whether it fixes your problem or not.

@rsc
Copy link
Contributor

rsc commented Apr 21, 2011

Comment 5:

This issue was closed by revision 29d78f1.

Status changed to Fixed.

@rsc
Copy link
Contributor

rsc commented Apr 21, 2011

Comment 6:

Issue #1701 has been merged into this issue.

@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

4 participants