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

Handle SIGUSR2 and dump goroutines on the signal #2526

Merged
merged 1 commit into from Jul 7, 2023
Merged

Handle SIGUSR2 and dump goroutines on the signal #2526

merged 1 commit into from Jul 7, 2023

Conversation

kzys
Copy link
Member

@kzys kzys commented Jul 4, 2023

When flyctl hangs, dumping all goroutines may be helpful to understand its internal state.

Docker uses SIGUSR1 for that, but it is already taken by wg/signals_unix.go.

https://community.fly.io/t/flyctl-v0-1-47-cannot-deploy-clone-and-list-machines/13940 https://github.com/moby/moby/blob/v24.0.2/daemon/debugtrap_unix.go#L17

Change Summary

What and Why:

flyctl v0.1.47 was hanging occasionally and we had no clues. This change may help us understand what's going on.

How:

Handling SIGUSR2 and dumping all goroutines' stacktraces.

Related to:

https://community.fly.io/t/flyctl-v0-1-47-cannot-deploy-clone-and-list-machines/13940


Documentation

  • Fresh Produce
  • In superfly/docs, or asked for help from docs team
  • n/a

When flyctl hangs, dumping all goroutines may be helpful to
understand its internal state.

Docker uses SIGUSR1 for that, but it is already taken by
wg/signals_unix.go.

https://community.fly.io/t/flyctl-v0-1-47-cannot-deploy-clone-and-list-machines/13940
https://github.com/moby/moby/blob/v24.0.2/daemon/debugtrap_unix.go#L17
@pborzenkov
Copy link
Contributor

There is a nice package called gops that integrates a lot of diagnostics - https://github.com/google/gops
Not only goroutines dump, but also profiler, memory stats, etc.
Maybe worth to consider it?

@kzys
Copy link
Member Author

kzys commented Jul 5, 2023

Having gops on our own hosts (e.g. backend servers) may be nice. For customer hosts (e.g. their laptops), I don't want to take a TCP port.

https://github.com/google/gops/blob/v0.3.27/agent/agent.go#L74

@kzys kzys marked this pull request as ready for review July 5, 2023 13:53
@kzys kzys merged commit d65f2f7 into master Jul 7, 2023
9 checks passed
@kzys kzys deleted the sigusr2 branch July 7, 2023 17:55
@matttpt matttpt mentioned this pull request Jul 7, 2023
3 tasks
kzys added a commit that referenced this pull request Jul 10, 2023
I recently added platform-specific .go files in #2526, which broke
Windows build (see #2540). We couldn't catch that during PRs since all
our tests are running on Linux.

This change runs flyctl's normal (not-preflight) tests on Windows and
macOS to catch issues that could break builds.
kzys added a commit that referenced this pull request Jul 10, 2023
I recently added platform-specific .go files in #2526, which broke
Windows build (see #2540). We couldn't catch that during PRs since all
our tests were running on Linux.

This change runs flyctl's normal (not-preflight) tests on Windows and
macOS to catch issues that could break builds.
@kzys kzys mentioned this pull request Jul 10, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants