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

Worker receives two TERM signals #5

Open
arifkalayci opened this issue Nov 7, 2019 · 1 comment
Open

Worker receives two TERM signals #5

arifkalayci opened this issue Nov 7, 2019 · 1 comment

Comments

@arifkalayci
Copy link

It looks like my worker receives two TERM signals when the Heroku dyno is restarted. Heroku docs says that:

When the dyno manager restarts a dyno, the dyno manager will request that your processes shut down gracefully by sending them a SIGTERM signal. This signal is sent to all processes in the dyno, not just the process type.

So that's the first signal. I guess the second signal is sent by the master process to the worker.
I am doing Delayed::Worker.raise_signal_exceptions = :term and rescue from SignalException to do some cleanup before exiting. In the case of two signals, the first is handled but the second is gets left unhandled. Any ideas on how to handle this two signals situation?

@jturkel
Copy link
Member

jturkel commented Nov 7, 2019

Interesting! We moved most of our applications off Heroku to Kubernetes awhile ago so we haven't noticed this. Perhaps we could add a configuration option that controls whether the delayed_job_worker_pool master process propagates the SIGTERM to child processes here. Ideally we could default that configuration properly for Heroku environments (the version of the stack might matter here too) vs. non-Heroku environments.

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

No branches or pull requests

2 participants