]> Cypherpunks repositories - gostls13.git/commit
runtime: fix MutexProfile missing root frames
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Sat, 7 Sep 2024 11:44:09 +0000 (13:44 +0200)
committerCarlos Amedee <carlos@golang.org>
Wed, 25 Sep 2024 17:30:33 +0000 (17:30 +0000)
commitc64ca8c6ef13723b9f25f4b5e1c7b6986b958d2e
tree9c4c48ed70b5faf7b648ffbf0724bc539e462c32
parent8c8948c375a97f8cc09b3b6c3a06c75c31d83aa0
runtime: fix MutexProfile missing root frames

Fix a regression introduced in CL 598515 causing runtime.MutexProfile
stack traces to omit their root frames.

In most cases this was merely causing the `runtime.goexit` frame to go
missing. But in the case of runtime._LostContendedRuntimeLock, an empty
stack trace was being produced.

Add a test that catches this regression by checking for a stack trace
with the `runtime.goexit` frame.

Also fix a separate problem in expandFrame that could cause
out-of-bounds panics when profstackdepth is set to a value below 32.
There is no test for this fix because profstackdepth can't be changed at
runtime right now.

Fixes #69335

Change-Id: I1600fe62548ea84981df0916d25072c3ddf1ea1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/611615
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Nick Ripley <nick.ripley@datadoghq.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/runtime/mprof.go
src/runtime/pprof/mprof_test.go
src/runtime/pprof/pprof_test.go