]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.7] runtime: force workers out before checking mark roots
authorAustin Clements <austin@google.com>
Wed, 18 Jan 2017 02:58:10 +0000 (21:58 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 25 Jan 2017 17:18:04 +0000 (17:18 +0000)
commitc4552c1c61d668886d31391a4694983b2912eaa7
treea513a7a51bda91639c7d94d2dd5392b49b5a6099
parentfaafe0e30c1779bd928e21421e67924108841c73
[release-branch.go1.7] runtime: force workers out before checking mark roots

Fixes #18700 (backport)

Currently we check that all roots are marked as soon as gcMarkDone
decides to transition from mark 1 to mark 2. However, issue #16083
indicates that there may be a race where we try to complete mark 1
while a worker is still scanning a stack, causing the root mark check
to fail.

We don't yet understand this race, but as a simple mitigation, move
the root check to after gcMarkDone performs a ragged barrier, which
will force any remaining workers to finish their current job.

Updates #16083. This may "fix" it, but it would be better to
understand and fix the underlying race.

Change-Id: I1af9ce67bd87ade7bc2a067295d79c28cd11abd2
Reviewed-on: https://go-review.googlesource.com/35678
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/mgc.go