aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorVlad Saioc <vsaioc@uber.com>2025-10-02 11:57:58 +0000
committerGopher Robot <gobot@golang.org>2025-10-02 11:06:21 -0700
commit8c68a1c1abade565c6719159858e76f9b122ddc8 (patch)
tree3da970e4a670a4ac23d748df30a87cd8daf9555a /src/net/http
parent84db201ae18c889acdefe20c8a903b188328f16d (diff)
downloadgo-8c68a1c1abade565c6719159858e76f9b122ddc8.tar.xz
runtime,net/http/pprof: goroutine leak detection by using the garbage collector
Proposal #74609 Change-Id: I97a754b128aac1bc5b7b9ab607fcd5bb390058c8 GitHub-Last-Rev: 60f2a192badf415112246de8bc6c0084085314f6 GitHub-Pull-Request: golang/go#74622 Reviewed-on: https://go-review.googlesource.com/c/go/+/688335 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: t hepudds <thepudds1460@gmail.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/pprof/pprof.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go
index 635d3ad9d9..e5a46ed253 100644
--- a/src/net/http/pprof/pprof.go
+++ b/src/net/http/pprof/pprof.go
@@ -77,6 +77,7 @@ import (
"fmt"
"html"
"internal/godebug"
+ "internal/goexperiment"
"internal/profile"
"io"
"log"
@@ -353,6 +354,7 @@ func collectProfile(p *pprof.Profile) (*profile.Profile, error) {
var profileSupportsDelta = map[handler]bool{
"allocs": true,
"block": true,
+ "goroutineleak": true,
"goroutine": true,
"heap": true,
"mutex": true,
@@ -372,6 +374,12 @@ var profileDescriptions = map[string]string{
"trace": "A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace.",
}
+func init() {
+ if goexperiment.GoroutineLeakProfile {
+ profileDescriptions["goroutineleak"] = "Stack traces of all leaked goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic."
+ }
+}
+
type profileEntry struct {
Name string
Href string