reddit/baseplate.py

queue_consumer server does not handle server timeouts correctly

Closed this issue · 2 comments

When the server timeout is exceeded gevent raises the ServerTimeout exception.

ServerTimeout inherits from BaseException instead of Exception to avoid getting caught by application code that does except Exception: ....

The queue_consumer server runs a bunch of worker threads wrapped in try/except Exception to catch exceptions and shut down all threads and kill the server. The server runs a http healthcheck endpoint so when it shuts down healthchecks will fail and hopefully the server will be restarted.

Because ServerTimeout isn't caught by the except Exception block the worker threads can die without killing the server and healthchecker, leaving the server running but in a broken state.

Just dropping the Exception part should fix it? Sounds good to me.