Is there a connection timeout limit of some sort?
I am running a flask app, which makes a streaming request to OpenAI API. It works fine locally. But on render.com after 30 seconds (± a second or so) the python seems to get an error, and my function restarts.
- I am using nginx in a container.
- I am using gunicorn (and have extended the timeout to 2 mins)
- I can’t see any useful logs that point to the error
I can’t narrow down the problem at the moment. Any ideas?
Hi Rich,
There is a timeout imposed by Render, but it’s 100 minutes.
I’d check into nginx/flask configuration, or possibly a timeout on OpenAI’s side.
Regards,
Matt
Ok, I’ve figured it out. In case it saves someone else a few hours…
Gunicorn was running both locally and on render.com. Locally, it was being initiatied by this line in my Dockerfile:
CMD [“gunicorn”, “–timeout”, “300”, “–config”, “gunicorn-cfg.py”, “run:app”]
And so it was correctly using gunicorn-cfg.py
On render , it seems this command wasn’t running, but gunicorn was being started based on the ‘Start Command’ in the ‘Settings’ page. When I updated that to:
gunicorn --timeout 300 --config gunicorn-cfg.py run:app
It all started working properly.