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

x/playground: no error reported when program gets stuck #53307

Open
adonovan opened this issue Jun 9, 2022 · 4 comments
Open

x/playground: no error reported when program gets stuck #53307

adonovan opened this issue Jun 9, 2022 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Jun 9, 2022

This program gets stuck in an endless function recursion: https://go.dev/play/p/6NKY1ZpmDV9:

func g() {
	g()
}

func main() {
	println("start")
	g() // expect to see "stack overflow" or perhaps "killed by timeout". Nope
	println("end")
}

but the playground simply reports "Program exited". It should either print "timeout running program" or print a stack trace if it ran out of stack. (Running on gotipplay reports "exited: status 137", which to cognoscenti means 128 + SIGKILL, which is better but still cryptic.)

Contrast with this program which gets stuck in a simple loop https://go.dev/play/p/Oq1QfpRiGk_5. It does report "timeout running program":

func main() {
	println("start")
	for {
	}
	println("end")
}
@prattmic prattmic changed the title playground: no error reported when program gets stuck x/playground: no error reported when program gets stuck Jun 9, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jun 9, 2022
@prattmic
Copy link
Member

prattmic commented Jun 9, 2022

Huh, I've never even heard of gotipplay. It seems slightly different than https://go.dev/play/p/6NKY1ZpmDV9?v=gotip, which has the same result as Go 1.18.

My best guess is that the process is getting killed by the OS before it gives a nice panic and we aren't handling that case well (by printing the exit code for example), but I'm not sure how to check that.

cc @findleyr @toothrot

@cherrymui
Copy link
Member

Running the program alone (outside of playground), it fails relatively quickly with stack overflow error. I wonder why that is not the case in playground. Perhaps playground has a rather small memory limit so it OOM-killed before the runtime's stack limit is reached?

https://go.dev/play/p/ly2AtpQZYae?v=gotip also gets no print.

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 9, 2022
@findleyr
Copy link
Contributor

findleyr commented Jun 9, 2022

Huh, I've never even heard of gotipplay. It seems slightly different than https://go.dev/play/p/6NKY1ZpmDV9?v=gotip, which has the same result as Go 1.18.

go.dev calls gotipplay as its backend when v=gotip. This is how multiple versions are supported from the frontend.

@Nasfame
Copy link
Contributor

Nasfame commented Nov 22, 2023

Getting: timeout with : https://go.dev/play/p/MMAPTkBWX3K?v=gotip

It seems like a stack overflow error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants