Unicorn exit timeout on Heroku after trapping TERM and sending QUIT

I think your custom signal handling is what’s causing the timeouts here.

EDIT: I’m getting downvoted for disagreeing with Heroku’s documentation and I’d like to address this.

Configuring your Unicorn application to catch and swallow the TERM signal is the most likely cause of your application hanging and not shutting down correctly.

Heroku seems to argue that catching and transforming a TERM signal into a QUIT signal is the right behavior to turn a hard shutdown into a graceful shutdown.

However, doing this seems to introduce the risk of no shutdown at all in some cases – the root of this bug. Users experiencing hanging dynos running Unicorn should consider the evidence and make their own decision based on first principles, not just documentation.

Leave a Comment