Bug #48605 Ping leaves closed connections in liveConnections, subsequent Exceptions
Submitted: 6 Nov 2009 18:06 Modified: 18 Dec 2009 17:16
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.11 OS:Any
Assigned to: Todd Farmer CPU Architecture:Any

[6 Nov 2009 18:06] Todd Farmer
Description:
LoadBalancingConnectionProxy.doPing() iterates through all underlying Connections in the liveConnections Map, calling ping() on each.  If any given Connection.ping() method throws a SQLException, it is caught, and the host is added to the global blacklist (if configured).  However, it is not removed from the liveConnections Map, leaving the Connection to be used at a later point, at which point it will fail because it is already closed.

How to repeat:
Test case to be attached.

Suggested fix:
Remove connections which generate SQLExceptions when ping() is called from the liveConnections Map.
[6 Nov 2009 23:26] Todd Farmer
Patch and test case

Attachment: diff.txt (text/plain), 7.06 KiB.

[6 Nov 2009 23:27] Todd Farmer
Uploaded proposed patch, which needs review before pushing.
[19 Nov 2009 15:33] Todd Farmer
Review complete:

<mark> todd: Okay, looks good. GO ahead and push.

Pushed in r877.
[18 Dec 2009 17:16] Tony Bedford
An entry has been added to the 5.2.11 changelog:

Ping left closed connections in the liveConnections map, causing subsequent Exceptions when that connection was used.