Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2135

Gremlin.Net ConnectionPool doesn't handle closed idle connections properly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.0
    • Fix Version/s: 3.4.1
    • Component/s: dotnet
    • Labels:
      None

      Description

      The ConnectionPool of Gremlin.Net checks whether a connection is actually still open before it returns that connection to execute a request (in SelectLeastUsedConnection):

      if (connection.IsOpen) return true;
      DefinitelyDestroyConnection(connection);
      

      However, the connection stays in the pool as DefinitelyDestroyConnection only disposes the connection:

      private void DefinitelyDestroyConnection(Connection connection)
      {
          connection.Dispose();
          Interlocked.Decrement(ref _nrConnections);
      }
      

      This is problematic as it can potentially fill the pool with unusable connections. Even worse, SelectLeastUsedConnection will likely return such an unusable connection since it only checks for the number of in-flight requests and a disposed connection won't have any in-flight requests. This means that GetConnectionFromPool will try to get a connection until another still valid connection also has no in-flight requests.

      Note: This all can only happen when a connection was closed while sitting idle in the pool which shouldn't usually happen due to the heartbeat. If a connection problem occurs during the execution of a request, then all connections will be closed and new ones will be created.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Florian Hockmann Florian Hockmann
                Reporter:
                Florian Hockmann Florian Hockmann
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: