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 2024/03/19 17:49:00 UTC

[jira] [Created] (TINKERPOP-3064) Allow borrowing a connection even if dead

Stephen Mallette created TINKERPOP-3064:
-------------------------------------------

             Summary: Allow borrowing a connection even if dead
                 Key: TINKERPOP-3064
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3064
             Project: TinkerPop
          Issue Type: Improvement
          Components: driver
    Affects Versions: 3.6.6
            Reporter: Stephen Mallette


An item for investigation/consideration - we rely on {{Connection.isDead()}} when borrowing a connection (in {{getLeastUsedVaildConnection()}}) and if true it's ignored. So, dead connections won't be borrowed and a new connection will be considered and we'll end up in {{waitForConnection}} which will keep trying that cycle. 

On a related note, {{Connection.isDead()}} is really just grabbing boolean values set by native code and as such ["you cannot be sure that the connection is still working at the moment you call the function"|https://stackoverflow.com/questions/34637911/how-channel-isactive-works-in-netty].

Since the driver only destroy/replace connections on the return of a connection, certain cases where there are channel errors and for complete disconnection of the {{Host}} and because calls to {{isDead()}} don't really give a perfect picture of the state of the driver, perhaps we should re-evaluate where/how {{isDead()}} is used? like, what if it was not used during connection borrowing, it could borrow one that was dead, it would fail and then head to replacement, rather than sit in the pool. would that be a more efficient handling of the pool and to shorten wait times for a connection? perhaps the driver is being too safe in this way? maybe {{isDead()}} switches to true in the time the driver writes to it? not sure if that theory holds water exactly but seems worth investigating a bit.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)