-
Notifications
You must be signed in to change notification settings - Fork 633
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ed and leaked connections are closed by ensuring this is always done in the restore method
…nectionState() to removeFromConnectionTracking()
…time-dependent variables
miklish
requested review from
stevehu,
zabooma,
jaydeepparekh1311 and
AkashWorkGit
December 12, 2023 21:58
…) to ensure it always gets run, even if exceptions are thrown in those methods
…has now been moved to the start of the borrow() method
AkashWorkGit
approved these changes
Dec 14, 2023
jaydeepparekh1311
approved these changes
Dec 14, 2023
hi @stevehu - fyi: merge conflict resolved |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theborrow()
andrestore()
methods ofSimpleURIConnectionPool
. In SimplePool v2, the leaked-connection check inrestore()
was removed. This check should be added back.The
findAndCloseLeakedConnections()
method must also be moved to the start ofborrow()
. When at the end of theborrow()
method, the connection leak check can be skipped due toborrow()
exiting via an exception (which can be thrown bySimpleConnectionMaker.makeConnection()
if connection-creation fails) before executing the leak check.The
SimpleConnectionState.borrow()
method needs to remove the unusedconnectionCreateTimeout
argument. Since this method is only used internally bySimpleURIConnectionPool
, 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 bothborrow()
andrestore()
, the connection leak checking mock test has been updated (specifically, theMockTimeoutLeakedConnection
class has been updated) to provide more information on connection leak finding and fixing.