gunicorn icon indicating copy to clipboard operation
gunicorn copied to clipboard

Workers hanging when an exception occurs

Open willnewton opened this issue 1 year ago • 0 comments

Hi,

I'm seeing some strange behaviour when certain exceptions get thrown in our gunicorn + Falcon app.

If a RuntimeError is thrown then an error is logged and processing continues as normal. However if I throw an exception with the base class BaseException then the worker dies and the server does not respond. I was expecting to get a 500 error and the worker to restart at minimum. Any ideas what's happening here?

An example app is here:

https://github.com/willnewton/exception-hang

Run with:

docker compose up --build

And see the difference between curling the two endpoints:

curl http://localhost:8080/runtime_error

curl http://localhost:8080/base_exception

Thanks!

willnewton avatar Apr 12 '23 16:04 willnewton