Uvicorn no response after 275 seconds

376 Views Asked by At

I am using FastAPI with Uvicorn. I have set --timeout-keep-alive to 600. When I run a small file, the process and response works fine. I get the 200 and the correct data. If the file is large, the requests.post keeps running for ever unless I add a timeout. I can see that the server finishes the process and gives a 200 message but it is not received by Python requests.

In order to test, in the same FastAPI app. I added a simple async function with a sleep. I found out that at exactly 275 seconds, it seems that the request losses connection with the server and does not get the response.

@app.get("/test/")
async def read_root():
    time.sleep(275)
    return {"Hello": "World"}

I have read the documentation and it seems there is no any other timeout. Any idea why this would be happening?

0

There are 0 best solutions below