Skip to content
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

Fix dangling socket causing uvicorn shutdown failure #211

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

kmichel-aiven
Copy link
Contributor

When using urllib3<=1.26.18 with uvicorn<=0.23.2 and python>=3.12, the socket shutdown method of urllib3 combines with the uvicorn server shutdown to leave the server stuck for many seconds:

encode/uvicorn#2145

Updating urllib3 or uvicorn (or downgrading Python) fixes the bug, but Fedora 39 shipped Python 3.12 with old urllib3 and uvicorn.

Since we (sadly) open a connection just for a single request every time, we can disable the HTTP keep-alive. This allows the server to close the connection earlier, without waiting for the client.

This fixes the failing tests/system/test_astacus.py::test_astacus on Fedora 39.

When using urllib3<=1.26.18 with uvicorn<=0.23.2 and python>=3.12,
the socket shutdown method of urllib3 combines with the uvicorn
server shutdown to leave the server stuck for many seconds:

encode/uvicorn#2145

Updating urllib3 or uvicorn (or downgrading Python) fixes the bug,
but Fedora 39 shipped Python 3.12 with old urllib3 and uvicorn.

Since we (sadly) open a connection just for a single request every
time, we can disable the HTTP keep-alive. This allows the server to
close the connection earlier, without waiting for the client.

This fixes the failing tests/system/test_astacus.py::test_astacus on
Fedora 39.
@kmichel-aiven kmichel-aiven marked this pull request as ready for review April 12, 2024 05:44
@kmichel-aiven kmichel-aiven requested a review from a team April 12, 2024 05:44
@aris-aiven aris-aiven merged commit 8453c41 into main Apr 12, 2024
3 checks passed
@aris-aiven aris-aiven deleted the kmichel-fix-dangly-socket branch April 12, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants