Descriptionruntime: fix spurious deadlock reporting
Fixes issue 2337.
Unfortunate sequence of events is:
1. maxcpu=2, mcpu=1, grunning=1
2. starttheworld creates an extra M:
maxcpu=2, mcpu=2, grunning=1
4. the goroutine calls runtime.GOMAXPROCS(1)
maxcpu=1, mcpu=2, grunning=1
5. since it sees mcpu>maxcpu, it calls gosched()
6. schedule() deschedules the goroutine:
maxcpu=1, mcpu=1, grunning=0
7. schedule() call getnextandunlock() which
fails to pick up the goroutine again,
because canaddcpu() fails, because mcpu==maxcpu
8. then it sees that grunning==0,
reports deadlock and terminates
Patch Set 1 #Patch Set 2 : diff -r a5126bbf1e47 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 6bf2b47bba7b https://go.googlecode.com/hg/ #Patch Set 4 : diff -r ee8a3dd0f7c6 https://go.googlecode.com/hg/ #Patch Set 5 : diff -r ee8a3dd0f7c6 https://go.googlecode.com/hg/ #Patch Set 6 : diff -r ee8a3dd0f7c6 https://go.googlecode.com/hg/ #Patch Set 7 : diff -r ee8a3dd0f7c6 https://go.googlecode.com/hg/ #Patch Set 8 : diff -r ee8a3dd0f7c6 https://go.googlecode.com/hg/ #Patch Set 9 : diff -r ee8a3dd0f7c6 https://go.googlecode.com/hg/ #Patch Set 10 : diff -r ee8a3dd0f7c6 https://go.googlecode.com/hg/ #
MessagesTotal messages: 3
|