Client disconnect during healthcheck on deploy

Every time I deploy my Python service, I get an exception raised by the Starlette web server:

RuntimeError: No response returned.

After investigating, it appears this exception occurs when a client disconnects before the request can be processed by the server.

Is this a known issue?

Hi Olivier,

Our healthchecks will connect to healthcheck endpoint you’ve defined for your service, and disconnect when an HTTP response code in the 200 or 300 range is returned. It looks like your healthcheck endpoint might still be trying to do processing and not expecting a disconnect. This is especially likely if the endpoint is using something like long polling for the endpoint.

Additionally, each Render healthcheck request will include a Render-Health-Check header set to 1, so looking for that might be useful to configure your application to ignore the disconnect.

Thanks, that’s very helpful. My impression was that the disconnect happened before the HTTP response was sent, but I’m not totally sure – the very nature of the issue makes it annoying to reproduce and debug as you can imagine :slight_smile:

Thanks for the tip about the header – swallowing the exception when the header is present will at least prevent a Sentry alert on every deploy.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.