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

Ensure leaked connections are closed in SimpleURIConnectionPool.restore() (SimplePool v2) (1.6.x) #2042

Merged
merged 25 commits into from
Dec 24, 2023

Conversation

miklish
Copy link
Collaborator

@miklish miklish commented Dec 12, 2023

Issue: #2028

(related to Issue: #2053 - was intended to be merged before #2053 - this is why the 'Files changed' is only a change to documentation)

In SimplePool v1, a leaked-connection check (findAndCloseLeakedConnections() method) was done in both the borrow() and restore() methods of SimpleURIConnectionPool. In SimplePool v2, the leaked-connection check in restore() was removed. This check should be added back.

The findAndCloseLeakedConnections() method must also be moved to the start of borrow(). When at the end of the borrow() method, the connection leak check can be skipped due to borrow() exiting via an exception (which can be thrown by SimpleConnectionMaker.makeConnection() if connection-creation fails) before executing the leak check.

The SimpleConnectionState.borrow() method needs to remove the unused connectionCreateTimeout argument. Since this method is only used internally by SimpleURIConnectionPool, it is not a breaking change.

Also, some refactorings and documentation updates can be done to clarify the code. These refactorings are at the SimplePool internal implementation level, and so are not breaking changes.

Finally, to coincide with re-addition of connection leak checking in the restore() method, and the change in its placement in both borrow() and restore(), the connection leak checking mock test has been updated (specifically, the MockTimeoutLeakedConnection class has been updated) to provide more information on connection leak finding and fixing.

@miklish
Copy link
Collaborator Author

miklish commented Dec 23, 2023

hi @stevehu - fyi: merge conflict resolved

@stevehu stevehu merged commit 3c665e6 into 1.6.x Dec 24, 2023
@stevehu stevehu deleted the issue2028 branch December 24, 2023 02:19
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.

4 participants