Ramzi Oueslati created TINKERPOP-1351: -----------------------------------------
Summary: Nb of connections going beyond the pool max size Key: TINKERPOP-1351 URL: https://issues.apache.org/jira/browse/TINKERPOP-1351 Project: TinkerPop Issue Type: Bug Components: driver Affects Versions: 3.2.0-incubating Environment: RESTful web service using gremlin driver to send request to a Gremlin Server Reporter: Ramzi Oueslati 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 : {code:java} 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); } {code} If many connections are borrowed at the same time then this code will schedule as many connections for creation. I added a check : {code:java} for (int i = 0; i < minPoolSize; i++) { if (scheduledForCreation.get() < minPoolSize) { scheduledForCreation.incrementAndGet(); logger.debug("borrowConnection: [inc] scheduledForCreation=" + scheduledForCreation.get()); newConnection(); } } {code} It seems to solve the problem. -- This message was sent by Atlassian JIRA (v6.3.4#6332)