TINKERPOP-2358 Stop leaking connections on Dispose in Gremlin.NET driver#1425
Merged
FlorianHockmann merged 1 commit into3.4-devfrom Jun 23, 2021
Merged
TINKERPOP-2358 Stop leaking connections on Dispose in Gremlin.NET driver#1425FlorianHockmann merged 1 commit into3.4-devfrom
FlorianHockmann merged 1 commit into3.4-devfrom
Conversation
If the `ConnectionPool` was disposed while it was in parallel creating new connections (e.g., to replace closed connections), those connections could be leaked. `Dispose()` could not dispose them yet as they were not completely established so they could be added to the pool. We now check after creating new connections whether the pool has been disposed in the meantime and then dispose these connections directly again. In addition to that, the pool now also has a `CancellationTokenSource` which allows us to cancel all active creations of new connections in `Dispose()`. So we don't have to wait until they are created only so we can then dispose them if we can already cancel the connection establishment.
This file contains hidden or 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
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.
https://issues.apache.org/jira/browse/TINKERPOP-2358
If the
ConnectionPoolwas disposed while it was in parallel creating new connections (e.g., to replace closed connections), thoseconnections could be leaked.
Dispose()could not dispose them yet as they were not completely established so they could be added to the pool.We now check after creating new connections whether the pool has been disposed in the meantime and then dispose these connections directly again.
In addition to that, the pool now also has a
CancellationTokenSourcewhich allows us to cancel all active creations of new connections inDispose(). So we don't have to wait until they are created only so we can then dispose them if we can already cancel the connection establishment.VOTE +1