8000 Improve socket resource management with proper shutdown sequence · Issue #3574 · urllib3/urllib3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve socket resource management with proper shutdown sequence #3574

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

Open
allrob23 opened this issue Mar 24, 2025 · 0 comments
Open

Improve socket resource management with proper shutdown sequence #3574

allrob23 opened this issue Mar 24, 2025 · 0 comments

Comments

@allrob23
Copy link

Description

An issue in socket handling where the "shutdown-then-close" pattern was not properly implemented in the error handling path of socket connections. As a result, socket lifecycle management is unreliable and unpredictable, particularly in error scenarios. This fix ensures more robust and consistent socket management by properly applying the recommended shutdown-then-close pattern.

Technical Details

The Python documentation explicitly recommends this approach:

"close() releases the resource associated with a connection but does not necessarily close the connection immediately. If you want to close the connection in a timely fashion, call shutdown() before close()."
— [Python Socket Documentation](https://docs.python.org/3/library/socket.html#socket.socket.close)

Please, see the PR #3573 to more details.

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

No branches or pull requests

1 participant
0