Skip to content

runtime: don't die after dumping goroutines on SIGQUIT #33282

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

Closed
rustyx opened this issue Jul 25, 2019 · 2 comments
Closed

runtime: don't die after dumping goroutines on SIGQUIT #33282

rustyx opened this issue Jul 25, 2019 · 2 comments

Comments

@rustyx
Copy link

rustyx commented Jul 25, 2019

go version go1.10.3 linux/amd64

When sending a SIGQUIT to a running Go process:

  1. It dumps its goroutines to stderr (as addressed by runtime: dump stacktrace for all goroutines from a running go process #2516).
  2. It exits.

It would have been a much more useful feature if SIGQUIT didn't kill the Go process, but only dumped the goroutines (i.e. did # 1 but not # 2).

NB: Java works that way -- a SIGQUIT dumps the threads, and then the JVM continues running normally. You can dump threads as many times as you like without killing the process.

@Freeaqingme
Copy link

Freeaqingme commented Jul 25, 2019

quote from Wikipedia:

SIGQUIT
The SIGQUIT signal is sent to a process by its controlling terminal when the user requests that the process quit and perform a core dump.

The name sigquit really implies to me that the primary objective is to quit, the core dump is an added bonus.

Also, java isn't always the best point of reference. Java probably did a lot of things right, but may have also accumulated some behavior that's suboptimal in hindsight.

@ianlancetaylor
Copy link
Contributor

Making that change at this point would break too many people's operating procedures, so we aren't going to implement it as written. I'm going to close this issue. Please comment if you disagree.

You can implement this general idea yourself using the os/signal package and the runtime.Stack function.

@golang golang locked and limited conversation to collaborators Jul 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants