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) #2028

Closed
miklish opened this issue Dec 5, 2023 · 0 comments
Assignees

Comments

@miklish
Copy link
Collaborator

miklish commented Dec 5, 2023

PR: #2042

(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.

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

2 participants