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: stack overflow should print top and bottom of stack #34219

Closed
dsnet opened this issue Sep 10, 2019 · 2 comments
Closed

runtime: stack overflow should print top and bottom of stack #34219

dsnet opened this issue Sep 10, 2019 · 2 comments

Comments

@dsnet
Copy link
Member

@dsnet dsnet commented Sep 10, 2019

Consider the following:

package main

func main() {
	unique1()
}

func unique1() { unique2() }
func unique2() { unique3() }
func unique3() { cycle1() }
func cycle1()  { cycle2() }
func cycle2()  { cycle3() }
func cycle3()  { cycle1() }

When run, it prints a stack that looks like:

runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

goroutine 1 [running]:
main.cycle3()
	main.go:13 +0x2e fp=0xc020084370 sp=0xc020084368 pc=0x44f71e
main.cycle2()
	main.go:12 +0x20 fp=0xc020084380 sp=0xc020084370 pc=0x44f6e0
main.cycle1()
	main.go:11 +0x20 fp=0xc020084390 sp=0xc020084380 pc=0x44f6b0
main.cycle3()
	main.go:13 +0x20 fp=0xc0200843a0 sp=0xc020084390 pc=0x44f710
main.cycle2()
	main.go:12 +0x20 fp=0xc0200843b0 sp=0xc0200843a0 pc=0x44f6e0
main.cycle1()
	main.go:11 +0x20 fp=0xc0200843c0 sp=0xc0200843b0 pc=0x44f6b0
main.cycle3()
	main.go:13 +0x20 fp=0xc0200843d0 sp=0xc0200843c0 pc=0x44f710
main.cycle2()
	main.go:12 +0x20 fp=0xc0200843e0 sp=0xc0200843d0 pc=0x44f6e0
main.cycle1()
	main.go:11 +0x20 fp=0xc0200843f0 sp=0xc0200843e0 pc=0x44f6b0
main.cycle3()
	main.go:13 +0x20 fp=0xc020084400 sp=0xc0200843f0 pc=0x44f710
...additional frames elided...

The fact that it prints "...additional frames elided..." is entirely reasonable. However, it probably helps to print both parts of the top and bottom of the stack. For example, this stack does not tell me that the entry to this cycle is through unique1, unique2, and unique3.

@randall77
Copy link
Contributor

@randall77 randall77 commented Sep 11, 2019

Dup of #7181 ?

@dsnet
Copy link
Member Author

@dsnet dsnet commented Sep 14, 2019

Indeed. Duplicate of #7181.

@dsnet dsnet closed this Sep 14, 2019
@golang golang locked and limited conversation to collaborators Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.