You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resque sends SIGTERM to signal the child process it should terminate, but this conflicts with Heroku, which sends SIGTERM to all processes when shutting down dynos. That is, your child receives SIGTERM from Heroku right away and RESQUE_PRE_SHUTDOWN_TIMEOUT is not honored.
However, this solution is partial, really, because Heroku documents it may send you multiple SIGTERMs, and I have confirmed it occasionally does. Therefore, you cannot assume the 2nd signal comes from the worker.
A clean way to solve this would be to tell Resque to use a different signal. I suspect this might be the intention with the existing
Meanwhile, I have opened resque/resque-heroku-signals#14 to redefine new_kill_child. That version sends SIGINT to the child, instead of SIGTERM. Then, unregister_signal_handlers ignores SIGTERM (coming from Heroku) and raises on SIGINT (coming from the worker).
Heroku is an important part of the Ruby ecosystem, I believe all that monkey patching is a symptom of missing support here.
Resque sends
SIGTERM
to signal the child process it should terminate, but this conflicts with Heroku, which sendsSIGTERM
to all processes when shutting down dynos. That is, your child receivesSIGTERM
from Heroku right away andRESQUE_PRE_SHUTDOWN_TIMEOUT
is not honored.The gem
resque-heroku-signals
addresses this by redefiningResque::Worker#unregister_signal_handlers
in a way that makes theSIGTERM
signal handler ignore the first occurrence, and raiseResque::TermException
on the second one.However, this solution is partial, really, because Heroku documents it may send you multiple
SIGTERM
s, and I have confirmed it occasionally does. Therefore, you cannot assume the 2nd signal comes from the worker.A clean way to solve this would be to tell Resque to use a different signal. I suspect this might be the intention with the existing
which seems to be unused as of this writing.
The text was updated successfully, but these errors were encountered: