]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: relax preemption assertion during stack split
authorRuss Cox <rsc@golang.org>
Mon, 28 Oct 2013 23:40:40 +0000 (19:40 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 28 Oct 2013 23:40:40 +0000 (19:40 -0400)
The case can happen when starttheworld is calling acquirep
to get things moving again and acquirep gets preempted.
The stack trace is in golang.org/issue/6644.

It is difficult to build a short test case for this, but
the person who reported issue 6644 confirms that this
solves the problem.

Fixes #6644.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/18740044

src/pkg/runtime/stack.c

index 011c616bacc450f950f2bf68978fbd9c5ad4e55d..634706051c223fbd90eed7d5dad8e6819a39774d 100644 (file)
@@ -255,7 +255,7 @@ runtime·newstack(void)
        if(gp->stackguard0 == (uintptr)StackPreempt) {
                if(gp == m->g0)
                        runtime·throw("runtime: preempt g0");
-               if(oldstatus == Grunning && m->p == nil)
+               if(oldstatus == Grunning && m->p == nil && m->locks == 0)
                        runtime·throw("runtime: g is running but p is not");
                if(oldstatus == Gsyscall && m->locks == 0)
                        runtime·throw("runtime: stack split during syscall");