diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2020-07-20 18:19:56 +0000 |
|---|---|---|
| committer | Michael Knyszek <mknyszek@google.com> | 2020-10-30 22:21:02 +0000 |
| commit | 64a9a75ce9a353ef3d488b8e3ca977bf6df204f8 (patch) | |
| tree | 61a4039fe50fba49a5e0d8e465e5670b44663b07 /src/database/sql | |
| parent | f96b62be2edd8acc08b79777d692937e8ed79b4a (diff) | |
| download | go-64a9a75ce9a353ef3d488b8e3ca977bf6df204f8.tar.xz | |
runtime: release worldsema with a direct G handoff
Currently worldsema is not released with direct handoff, so the
semaphore is an unfair synchronization mechanism. If, for example,
ReadMemStats is called in a loop, it can continuously stomp on attempts
by the GC to stop the world.
Note that it's specifically possible for ReadMemStats to delay a STW to
end GC since ReadMemStats is able to STW during a GC since #19112 was
fixed.
While this particular case is unlikely and the right answer in most
applications is to simply not call such an expensive operation in a
loop, this pattern is used often in tests.
Fixes #40459.
Change-Id: Ia4a54f0fd956ea145a319f9f06c4cd37dd52fd8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/243977
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/database/sql')
0 files changed, 0 insertions, 0 deletions
