Skip to content

Commit d7a3576

Browse files
committed
goroutinedumper: use allstacks to dump stacks
1 parent d040360 commit d7a3576

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pkg/server/goroutinedumper/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ go_library(
99
"//pkg/server/dumpstore",
1010
"//pkg/settings",
1111
"//pkg/settings/cluster",
12+
"//pkg/util/allstacks",
1213
"//pkg/util/log",
1314
"//pkg/util/timeutil",
1415
"@com_github_cockroachdb_errors//:errors",

pkg/server/goroutinedumper/goroutinedumper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
"context"
1111
"fmt"
1212
"os"
13-
"runtime/pprof"
1413
"strings"
1514
"time"
1615

1716
"github.com/cockroachdb/cockroach/pkg/server/dumpstore"
1817
"github.com/cockroachdb/cockroach/pkg/settings"
1918
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
19+
"github.com/cockroachdb/cockroach/pkg/util/allstacks"
2020
"github.com/cockroachdb/cockroach/pkg/util/log"
2121
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
2222
"github.com/cockroachdb/errors"
@@ -162,7 +162,7 @@ func takeGoroutineDump(path string) error {
162162
}
163163
defer f.Close()
164164
w := gzip.NewWriter(f)
165-
if err = pprof.Lookup("goroutine").WriteTo(w, 2); err != nil {
165+
if _, err := w.Write(allstacks.Get()); err != nil {
166166
return errors.Wrapf(err, "error writing goroutine dump to %s", path)
167167
}
168168
// Flush and write the gzip header. It doesn't close the underlying writer.

0 commit comments

Comments
 (0)