[
https://issues.apache.org/jira/browse/TINKERPOP-2871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17747215#comment-17747215
]
Ken Hu commented on TINKERPOP-2871:
---
Short reproducer:
{code:java}
public static void main(String[] args) {
ExecutorService jobQueue = Executors.newFixedThreadPool(500); // (1)
Cluster cluster = Cluster.build("localhost")
.maxInProcessPerConnection(8)
.maxSimultaneousUsagePerConnection(8) // (2)
.create();
Client.ClusteredClient client = cluster.connect(); for (int i=0; i<1000;
i++) {
jobQueue.submit( () -> {
try {
client.submit("Thread.sleep(2000)");
} catch (Exception e) {
;
}
});
}
} {code}
Running this code for 3.5-dev, you can see entries like "borrowed=486
pending=486", but in 3.6-dev, the highest observed value will be "borrowed=8
pending=0". In 3.5-dev, you can "borrow" a connection more than what is
specified by "maxSimultaneousUsagePerConnection" which isn't supposed to
happen. If you look at (2) in the example, you can see that the maximum should
be 8. This borrowed count is affected by what is set in (1) as a larger
threadpool will allow the count to go higher. I suspect the borrow count isn't
actually incorrect, rather in 3.5-dev, you can borrow a connection many more
times than you should be able to.
This behavior was fixed in TINKERPOP-2486 by
https://github.com/apache/tinkerpop/pull/1465. Seeing as this has already been
fixed in 3.6-dev, we can probably just close off this ticket as we previously
decided not to backport this change to 3.5-dev.
> Borrowed count can be wildly incorrect
> --
>
> Key: TINKERPOP-2871
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2871
> Project: TinkerPop
> Issue Type: Bug
> Components: driver
>Affects Versions: 3.5.5
>Reporter: Stephen Mallette
>Priority: Critical
>
> It doesn't seem like it affects the algorithm for borrowing/closing
> connections in the pool but the borrowed counter can sometimes reach wildly
> large numbers. it shows up in the log and is confusing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)