Search code examples
djangoherokutimeoutgunicornsentry

Django Gunicorn different type of timeout


I serve a Django app with Gunicorn (using Heroku) and Sentry for monitoring. I regularly receive 2 different types of timeout error on Sentry:

  1. SystemExit 1 in gunicorn/workers/base.py in handle_abort at line 201
  2. WORKER TIMEOUT (pid:12345) at the Gunicorn level

For the second one, It produces H13 errors in Heroku which according to the docs means:

This error is thrown when a process in your web dyno accepts a connection but then closes the socket without writing anything to it. One example where this might happen is when a Unicorn web server is configured with a timeout shorter than 30s and a request has not been processed by a worker before the timeout happens. In this case, Unicorn closes the connection before any data is written, resulting in an H13.

which is clear enough.

However for the System Exit 1, I read that it was a timeout in a similar ticket but I am not sure exactly what is the difference.


Solution

  • SystemExit is just the generic "stop process" signal, it could be that the same error is caught twice by Sentry (once thrown as exception, once logged with level=error).