Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: elided panic goroutine stack trace doesn't print "additional frames elided" since go1.8 #32383

Open
maruel opened this issue Jun 2, 2019 · 3 comments

Comments

@maruel
Copy link
Contributor

commented Jun 2, 2019

Repro

https://play.golang.org/p/zcDltp375Sf

package main

func recurse(i int) {
	if i > 0 {
		recurse(i - 1)
		return
	}
	panic(42)
}

func main() {
	recurse(100)
}

Or:

$ go get github.com/maruel/panicparse/cmd/panic
$ panic stack_cut_off

Expected

This is the case in go1.7.6:

(...)
main.recurse(0x61)
        /home/maruel/go/src/github.com/maruel/panicparse/cmd/panic/main.go:56 +0x33
main.recurse(0x62)
        /home/maruel/go/src/github.com/maruel/panicparse/cmd/panic/main.go:56 +0x33
...additional frames elided...

runtime/traceback.go#L751 is supposed to print("...additional frames elided...\n") when the stack trace is more than _TracebackMaxFrames, defined as 100 in runtime/runtime2.go#L786

Actual

It is not effective since go1.8.

(...)
main.recurse(0x61)
        /home/maruel/go/src/github.com/maruel/panicparse/cmd/panic/main.go:56 +0x33
main.recurse(0x62)
        /home/maruel/go/src/github.com/maruel/panicparse/cmd/panic/main.go:56 +0x33

Investigation

cat > ~/test_golang.sh <<EOF
#!/bin/bash
set -eu
cd ~/src/golang/src
./make.bash
go install github.com/maruel/panicparse/cmd/panic
panic stack_cut_off |& grep 'additional frames elided'
EOF
chmod +x ~/test_golang.sh

git bisect start go1.8 go1.7.6
git bisect run ~/test_golang.sh
git bisect reset

Found the culprit commit to be f9feaff reviewed at https://go-review.googlesource.com/c/go/+/33165/

@agnivade agnivade changed the title elided panic goroutine stack trace doesn't print "additional frames elided" since go1.8 runtime: elided panic goroutine stack trace doesn't print "additional frames elided" since go1.8 Jun 2, 2019
@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 2, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Jun 2, 2019

Change https://golang.org/cl/180077 mentions this issue: runtime: add back elided stack footer on traces of over 100 depth

@maruel

This comment has been minimized.

Copy link
Contributor Author

commented Jun 2, 2019

While investigating, I realized that stack depth can expand well over 100 (is it due to compile time inlining?). Here's an interesting example: https://play.golang.org/p/lQ_TDHJjyUw

Also I think my "fix" is incorrect. Still investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.