]> Cypherpunks repositories - gostls13.git/commit
runtime: don't hold trace.lock over semrelease in readTrace0
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 21 Nov 2023 23:24:59 +0000 (23:24 +0000)
committerMichael Knyszek <mknyszek@google.com>
Wed, 22 Nov 2023 16:31:04 +0000 (16:31 +0000)
commite4ea6283e484b7c1e8263c3cda8647b1962815db
treefa51c7a66e5aa83c0e2713a546144a7c9d6a7518
parent5249947f11b8238c2e2b878665be411fc6ba194b
runtime: don't hold trace.lock over semrelease in readTrace0

semrelease may unblock a goroutine, but the act of unblocking a
goroutine may emit an event, which in turn may try to acquire trace.lock
again.

It's safe to release trace.lock in readTrace0 for this because all of
the state (one variable) it uses under the lock will be recomputed when
it reacquires the lock. There's also no other synchronization
requirement to hold trace.lock. This is just a mistake.

Change-Id: Iff6c6b02efa298ebed8e60cdf6539ec161d5ec48
Reviewed-on: https://go-review.googlesource.com/c/go/+/544178
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/trace2.go