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

Logging of received signals #2701

Closed
firefart opened this issue Sep 15, 2021 · 2 comments
Closed

Logging of received signals #2701

firefart opened this issue Sep 15, 2021 · 2 comments
Labels

Comments

@firefart
Copy link

Hi,
we currently investigate why our workers get restarted in a kubernetes cluster and I noticed puma only logs the boot messages like so

[1] - Worker 0 (PID: 10) booted in 0.1s, phase: 0
[1] - Worker 1 (PID: 17) booted in 0.1s, phase: 0
[1] - Worker 2 (PID: 25) booted in 0.01s, phase: 0
[1] - Worker 3 (PID: 33) booted in 0.0s, phase: 0

Is there a way to log the receive of all handled signals documented here https://github.com/puma/puma/blob/master/docs/signals.md to the log? This would help in troubleshooting to see which signals where sent to puma.

@nateberkopec
Copy link
Member

I think you can have multiple Signal handlers, right?

Just drop:

%w[kill int].each do { |s| Signal.trap(s, some_stuff_to_log) }

into your app somewhere?

@jjb
Copy link
Contributor

jjb commented Oct 5, 2021

that code will replace the puma signal handler. here's how to add signal handler behavior while preserving existing behavior: sidekiq/sidekiq#4991

in the sidekiq case, initializer code runs before the sidekiq handler is defined, so that PR is necessary to allow users to augment the signal handlers. im not sure if puma's signal handlers get defined after rails initializers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants