Skip to content

Commit bb5eb51

Browse files
committed
runtime/pprof: fix errors in pprof_test
I think the original depth-1 argument to allocDeep was correct. Reverted that, and also the change to maxSkip in mprof.go, which was also incorrect. I think before we were usually passing accidentally in the loop over matched stacks when we really should usually have been passing in the previous loop. Change-Id: I6a6a696463e2baf045b66f418d7afbfcb49258e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/712100 Reviewed-by: Michael Matloob <matloob@google.com> TryBot-Bypass: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
1 parent 5c9a26c commit bb5eb51

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/runtime/mprof.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const (
4949
// desired maximum number of frames after expansion.
5050
// This should be at least as large as the largest skip value
5151
// used for profiling; otherwise stacks may be truncated inconsistently
52-
maxSkip = 8
52+
maxSkip = 6
5353

5454
// maxProfStackDepth is the highest valid value for debug.profstackdepth.
5555
// It's used for the bucket.stk func.

src/runtime/pprof/pprof_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,9 +2549,6 @@ func TestProfilerStackDepth(t *testing.T) {
25492549

25502550
for _, test := range tests {
25512551
t.Run(test.profiler, func(t *testing.T) {
2552-
if test.profiler == "heap" {
2553-
testenv.SkipFlaky(t, 74029)
2554-
}
25552552
var buf bytes.Buffer
25562553
if err := Lookup(test.profiler).WriteTo(&buf, 0); err != nil {
25572554
t.Fatalf("failed to write heap profile: %v", err)
@@ -2586,6 +2583,7 @@ func TestProfilerStackDepth(t *testing.T) {
25862583
t.Logf("matched stack=%s", stk)
25872584
if len(stk) != depth {
25882585
t.Errorf("want stack depth = %d, got %d", depth, len(stk))
2586+
continue
25892587
}
25902588

25912589
if rootFn, wantFn := stk[depth-1], "runtime/pprof.allocDeep"; rootFn != wantFn {
@@ -2663,7 +2661,7 @@ func goroutineDeep(t *testing.T, n int) {
26632661
// guaranteed to have exactly the desired depth with produceProfileEvents as
26642662
// their root frame which is expected by TestProfilerStackDepth.
26652663
func produceProfileEvents(t *testing.T, depth int) {
2666-
allocDeep(depth + 1) // +1 for produceProfileEvents, **
2664+
allocDeep(depth - 1) // -1 for produceProfileEvents, **
26672665
blockChanDeep(t, depth-2) // -2 for produceProfileEvents, **, chanrecv1
26682666
blockMutexDeep(t, depth-2) // -2 for produceProfileEvents, **, Unlock
26692667
memSink = nil

0 commit comments

Comments
 (0)