You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "stephen mallette (JIRA)" <ji...@apache.org> on 2016/06/29 11:57:37 UTC
[jira] [Commented] (TINKERPOP-1351) Nb of connections going beyond
the pool max size
[ https://issues.apache.org/jira/browse/TINKERPOP-1351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15355091#comment-15355091 ]
stephen mallette commented on TINKERPOP-1351:
---------------------------------------------
I just noticed that while doing some testing on that other issue you raised....Do you want to offer a pull request with the fix you mentioned in the description?
> 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)