• Austin Clements's avatar
    [release-branch.go1.8] runtime: doubly fix "double wakeup" panic · 18a13d37
    Austin Clements authored
    Cherry-pick of CL 43311.
    
    runtime.gchelper depends on the non-atomic load of work.ndone
    happening strictly before the atomic add of work.nwait. Until very
    recently (commit 978af9c2, fixing #20334), the compiler reordered
    these operations. This created a race since work.ndone can change as
    soon as work.nwait is equal to work.ndone. If that happened, more than
    one gchelper could attempt to wake up the work.alldone note, causing a
    "double wakeup" panic.
    
    This was fixed in the compiler, but to make this code less subtle,
    make the load of work.ndone atomic. This clearly forces the order of
    these operations, ensuring the race doesn't happen.
    
    Fixes #19305 (though really 978af9c2 fixed it).
    
    Change-Id: Ieb1a84e1e5044c33ac612c8a5ab6297e7db4c57d
    Reviewed-on: https://go-review.googlesource.com/43412
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    18a13d37
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...