-
-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uvicorn not closing sockets #1199
Comments
I don't see how the change of worker class would solve this issue 🤔 |
It maybe because h11 will close the transport when if the connection is invalid HTTP request, this issue similarity to #1192 |
Yes @pacoyang this seems to be exactly the problem we are seeing. Thanks! |
@johnrtipton from which version did you guys upgrade? 0.13.4? |
@Kludex We upgraded from |
We encountered the issue in our systems as well, a simple fastapi service behind AWS EKS load-balancer A simple program to reproduce import uvicorn
async def app(scope, receive, send):
assert scope["type"] == "http"
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [
[b"content-type", b"text/plain"],
],
}
)
await send(
{
"type": "http.response.body",
"body": b"Hello, world!",
}
)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", reload=False, log_level=5) and run apparently, it got something to do with uvloop don't call connection_lost or something |
Looks like #1332 was released with 0.17.1 and this can be closed? |
Dunno, why it is closed, still happens all the time. |
Lol, reverted in 2022. |
This issue was solved. If you have a similar issue, please create a discussion. |
We are using the latest uvicorn 0.15. It seems that after we upgraded to uvicorn 0.15 that our AWS load balancer health checks fail after a certain amount of time. Upon further investigation we found that all of our sockets are being used up because they are staying open in a CLOSE_WAIT status.
Workaround
For now we have switched our worker from UvicornWorker to UvicornH11Worker and it has resolved our issue.
Environment
Running uvicorn 0.15.0 with CPython 3.7.12 on Linux
The text was updated successfully, but these errors were encountered: