]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.23] runtime: fix MutexProfile missing root frames
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Sat, 7 Sep 2024 11:44:09 +0000 (13:44 +0200)
committerMichael Pratt <mpratt@google.com>
Wed, 30 Oct 2024 17:05:06 +0000 (17:05 +0000)
commita0d15cb9c8f3c35c96129857984d25446041f29e
tree2647645f37e989e7db9fb8832621bc0a9527d999
parent958f3a0309855bc2e362e2951c70849ebec76f30
[release-branch.go1.23] 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 #69865

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>
(cherry picked from commit c64ca8c6ef13723b9f25f4b5e1c7b6986b958d2e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/621276
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/mprof.go
src/runtime/pprof/mprof_test.go
src/runtime/pprof/pprof_test.go