]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.20] runtime: resolve checkdead panic by refining `startm` lock...
authorLucien Coffe <lucien.coffe@botify.com>
Fri, 21 Apr 2023 11:44:35 +0000 (13:44 +0200)
committerGopher Robot <gobot@golang.org>
Thu, 22 Jun 2023 15:28:32 +0000 (15:28 +0000)
commit3db4f8146c0a7e41a234042eb2057fbfddc17e5f
tree4be55448baedcfd7a3211ea008c2b7a6292e83ca
parent6b45fb7b73636dc56b54652d7090de9db3dfff30
[release-branch.go1.20] runtime: resolve checkdead panic by refining `startm` lock handling in caller context

This change addresses a `checkdead` panic caused by a race condition between
`sysmon->startm` and `checkdead` callers, due to prematurely releasing the
scheduler lock. The solution involves allowing a `startm` caller to acquire the
scheduler lock and call `startm` in this context. A new `lockheld` bool
argument is added to `startm`, which manages all lock and unlock calls within
the function. The`startIdle` function variable in `injectglist` is updated to
call `startm` with the lock held, ensuring proper lock handling in this
specific case. This refined lock handling resolves the observed race condition
issue.

For #59600.
Fixes #60760.

Change-Id: I11663a15536c10c773fc2fde291d959099aa71be
Reviewed-on: https://go-review.googlesource.com/c/go/+/487316
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
(cherry picked from commit ff059add10d71fe13239cf893c0cca113de1fc21)
Reviewed-on: https://go-review.googlesource.com/c/go/+/504395
Reviewed-by: Lucien Coffe <lucien.coffe@botify.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
src/runtime/proc.go