Skip to content

Raise exception for shutdown on a connection already released to the pool #3601

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

Merged
merged 8 commits into from
Jun 15, 2025

Conversation

alexprabhat99
Copy link
Contributor

Closes: #3581

@alexprabhat99
Copy link
Contributor Author

@sethmlarson Could you please review this? Thank you!

@@ -1073,6 +1076,10 @@ def readable(self) -> bool:
return True

def shutdown(self) -> None:
if self._released_conn:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self._released_conn:
if not self._connection:

There's no need for an extra attribute here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@D-stefaang Thank you for the review. I have removed the extra attribute now.



class TestShutdownOnConnectionReleasedToPool(HypercornDummyServerTestCase):
def test_shutdown_on_connection_released_to_pool(self) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this test to be after test_cleanup_on_connection_error? We don't want to many HypercornDummyServerTestCase as they start a new server each time.

Copy link
Contributor Author

@alexprabhat99 alexprabhat99 Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pquentin Thank you for your review. I have moved the new test to be after test_cleanup_on_connection_error.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM. Sorry for the 2 months delay. Please ask for $100 on Open Collective, with links to the issue and pull request and post back the link here.

@pquentin pquentin merged commit 8e32e60 into urllib3:main Jun 15, 2025
35 checks passed
@alexprabhat99
Copy link
Contributor Author

@pquentin Thank you for the opportunity to contribute!
Here’s the Open Collective link: https://opencollective.com/urllib3/expenses/253986

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.

HTTPResponse.shutdown may shut down a connection already released to the pool
3 participants