You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Florian Hockmann (JIRA)" <ji...@apache.org> on 2019/02/05 12:04:00 UTC

[jira] [Commented] (TINKERPOP-2148) "no connection available!" is being thrown despite lots of free connections

    [ https://issues.apache.org/jira/browse/TINKERPOP-2148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16760728#comment-16760728 ] 

Florian Hockmann commented on TINKERPOP-2148:
---------------------------------------------

Unfortunately, this can happen quite easily in 3.4.0 as the driver [first selects|https://github.com/apache/tinkerpop/blob/90c5e2f66c7d6ae15753599144fe6ace78b847e0/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs#L113] the least used connection and then it checks whether it has less than {{MaxInProcessPerConnection}} which results in this exception. If now 2 requests come in in parallel and both get the same connection as the least used one, then you get that exception although other connections are available which haven't reached that limit yet.

I guess we could add a dedicated counter on the {{Connection}} object that we increment as soon as the {{Connection}} is selected as the least used one and add some synchronization to prevent race conditions like this.

For your current problem, I suggest that you use a much higher limit for {{MaxInProcessPerConnection}}. The default limit of 32 should make this exception a lot less likely to occur.

> "no connection available!" is being thrown despite lots of free connections
> ---------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2148
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2148
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: dotnet
>    Affects Versions: 3.4.0
>         Environment: Windows 10, C#, .NET Core, CosmosDB Graph
>            Reporter: Zaoshi
>            Priority: Minor
>
> I am submitting multiple graph queries in parallel but in some cases it starts throwing this exception:
> {{Gremlin.Net.Driver.Exceptions.NoConnectionAvailableException : no connection available!}}
> {{  at Gremlin.Net.Driver.ConnectionPool.GetAvailableConnectionAsync()}}
> {{  at Gremlin.Net.Driver.GremlinClient.SubmitAsync[T](RequestMessage requestMessage)}}
> When GremlinClient is initialized with \{PoolSize = 1, MaxInProcessPerConnection = 8} everything works fine, however, with \{PoolSize = 8, MaxInProcessPerConnection = 1} it starts throwing those exceptions even though this connection pool should have same throughput. I have tried to increase pool to \{PoolSize = 128, MaxInProcessPerConnection = 1} but GremlinClient started to fail even more.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)