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

Number of connections going beyond the pool max size

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.2-incubating
    • 3.1.3, 3.2.1
    • driver
    • None
    • RESTful web service using gremlin driver to send request to a Gremlin Server

    Description

      When the gremlin driver is used with an important number of concurrent requests, sockets are opened far beyond the max pool size.

      At some point, the connections are destroyed, the pool is empty and then the borrowConnection process goes through :

              if (connections.isEmpty()) {
                  logger.debug("Tried to borrow connection but the pool was empty for {} - scheduling pool creation and waiting for connection", host);
                  for (int i = 0; i < minPoolSize; i++) {
                      scheduledForCreation.incrementAndGet();
                      newConnection();
                  }
      
                  return waitForConnection(timeout, unit);
              }
      

      If many connections are borrowed at the same time then this code will schedule as many connections for creation.

      I added a check :

                  for (int i = 0; i < minPoolSize; i++) {
                      if (scheduledForCreation.get() < minPoolSize) {
                          scheduledForCreation.incrementAndGet();
                          logger.debug("borrowConnection: [inc] scheduledForCreation=" + scheduledForCreation.get());
                          newConnection();
                      }
                  }
      

      It seems to solve the problem.

      Attachments

        Activity

          People

            spmallette Stephen Mallette
            Ramzi Ramzi Oueslati
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: