Skip to content

TINKERPOP-2358 Stop leaking connections on Dispose in Gremlin.NET driver#1425

Merged
FlorianHockmann merged 1 commit into3.4-devfrom
TINKERPOP-2358
Jun 23, 2021
Merged

TINKERPOP-2358 Stop leaking connections on Dispose in Gremlin.NET driver#1425
FlorianHockmann merged 1 commit into3.4-devfrom
TINKERPOP-2358

Conversation

@FlorianHockmann
Copy link
Member

https://issues.apache.org/jira/browse/TINKERPOP-2358

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.

VOTE +1

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.
@FlorianHockmann FlorianHockmann merged commit 057a83b into 3.4-dev Jun 23, 2021
@FlorianHockmann FlorianHockmann deleted the TINKERPOP-2358 branch June 23, 2021 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant