Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.6.6
-
None
-
None
Description
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".
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.