]> Cypherpunks repositories - gostls13.git/commit
runtime: increase profiling stack depth to 128
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Fri, 17 May 2024 13:07:07 +0000 (15:07 +0200)
committerAustin Clements <austin@google.com>
Tue, 21 May 2024 14:38:45 +0000 (14:38 +0000)
commit1b9dc3e178be578cf1d8c06fe371283a58bdd93f
treedbb08b918c207889947b86dceea405ca889376a4
parent47187a4f4f226c4b9e0e920c5ad1ec9ce83bdc35
runtime: increase profiling stack depth to 128

The current stack depth limit for alloc, mutex, block, threadcreate and
goroutine profiles of 32 frequently leads to truncated stack traces in
production applications. Increase the limit to 128 which is the same
size used by the execution tracer.

Create internal/profilerecord to define variants of the runtime's
StackRecord, MemProfileRecord and BlockProfileRecord types that can hold
arbitrarily big stack traces. Implement internal profiling APIs based on
these new types and use them for creating protobuf profiles and to act
as shims for the public profiling APIs using the old types.

This will lead to an increase in memory usage for applications that
use the impacted profile types and have stack traces exceeding the
current limit of 32. Those applications will also experience a slight
increase in CPU usage, but this will hopefully soon be mitigated via CL
540476 and 533258 which introduce frame pointer unwinding for the
relevant profile types.

For #43669.

Change-Id: Ie53762e65d0f6295f5d4c7d3c87172d5a052164e
Reviewed-on: https://go-review.googlesource.com/c/go/+/572396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
12 files changed:
doc/next/6-stdlib/99-minor/runtime/pprof/43669.md [new file with mode: 0644]
src/cmd/internal/objabi/pkgspecial.go
src/go/build/deps_test.go
src/internal/profilerecord/profilerecord.go [new file with mode: 0644]
src/runtime/cpuprof.go
src/runtime/mprof.go
src/runtime/pprof/pprof.go
src/runtime/pprof/pprof_test.go
src/runtime/pprof/protomem.go
src/runtime/pprof/protomem_test.go
src/runtime/proc.go
src/runtime/tracestack.go