diff options
| author | Russ Cox <rsc@golang.org> | 2015-06-16 19:20:18 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-06-17 17:56:26 +0000 |
| commit | 3c60e6e8cfc6da21fc12aadaff63d780310ba822 (patch) | |
| tree | 0b56ec54c87cb786c8a296ff75d0952c4f5452bb /src/runtime/stack1.go | |
| parent | a2aaede366f9bf6d48e6e42be0a86a843f570097 (diff) | |
| download | go-3c60e6e8cfc6da21fc12aadaff63d780310ba822.tar.xz | |
runtime: fix races in stack scan
This fixes a hang during runtime.TestTraceStress.
It also fixes double-scan of stacks, which leads to
stack barrier installation failures.
Both of these have shown up as flaky failures on the dashboard.
Fixes #10941.
Change-Id: Ia2a5991ce2c9f43ba06ae1c7032f7c898dc990e0
Reviewed-on: https://go-review.googlesource.com/11089
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/stack1.go')
| -rw-r--r-- | src/runtime/stack1.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/runtime/stack1.go b/src/runtime/stack1.go index cb2110efb6..c5ffb0e130 100644 --- a/src/runtime/stack1.go +++ b/src/runtime/stack1.go @@ -756,13 +756,16 @@ func newstack() { // be set and gcphasework will simply // return. } - gcphasework(gp) + if !gp.gcscandone { + scanstack(gp) + gp.gcscandone = true + } + gp.preemptscan = false + gp.preempt = false casfrom_Gscanstatus(gp, _Gscanwaiting, _Gwaiting) casgstatus(gp, _Gwaiting, _Grunning) gp.stackguard0 = gp.stack.lo + _StackGuard - gp.preempt = false - gp.preemptscan = false // Tells the GC premption was successful. - gogo(&gp.sched) // never return + gogo(&gp.sched) // never return } // Act like goroutine called runtime.Gosched. |
