[
https://issues.apache.org/jira/browse/TINKERPOP-1766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16155059#comment-16155059
]
ASF GitHub Bot commented on TINKERPOP-1766:
-------------------------------------------
Github user jorgebay commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/704#discussion_r137214097
--- Diff: gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs ---
@@ -74,6 +85,36 @@ private void AddConnection(Connection connection)
}
}
+ private void ConsiderUnavailable()
+ {
+ CloseAndRemoveAllConnections();
+ }
+
+ private void CloseAndRemoveAllConnections()
+ {
+ lock (_connectionsLock)
+ {
+ TeardownAsync().WaitUnwrap();
+ RemoveAllConnections();
+ }
+ }
+
+ private void RemoveAllConnections()
+ {
+ while (!_connections.IsEmpty)
+ {
+ _connections.TryTake(out var connection);
+ connection.Dispose();
+ }
+ }
+
+ private async Task TeardownAsync()
+ {
+ var closeTasks = new List<Task>(_connections.Count);
--- End diff --
The list isn't necessary, you can use the `Task.WhenAll(IEnumerable<Task>)`
overload instead: `Task.WhenAll(_connections.Select(c => c.CloseAsync()))`
> Gremlin.Net: Closed connections should not be re-used
> ------------------------------------------------------
>
> Key: TINKERPOP-1766
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1766
> Project: TinkerPop
> Issue Type: Bug
> Components: language-variant
> Affects Versions: 3.3.0, 3.2.6
> Reporter: Florian Hockmann
>
> The driver of Gremlin.Net is kept very simle which holds especially true for
> the {{ConnectionPool}}. It simply returns every connection to its pool of
> usable connections that was {{disposed}} by the client. Unfortunately, this
> also applies in case the submit failed due to an already closed connection
> which means that the client will get the closed connection back from the
> {{ConnectionPool}} later and continues trying to submit messages over this
> closed connection.
> This can be fixed by checking whether the {{Connection}} is still open before
> adding it back to the {{ConnectionPool}}.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)