Bug #75885 Bug#20204783 fix exposes wrong beahaviors in failover connections
Submitted: 13 Feb 2015 2:22 Modified: 9 Mar 2015 21:33
Reporter: Filipe Silva Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.35 OS:Any
Assigned to: CPU Architecture:Any

[13 Feb 2015 2:22] Filipe Silva
Description:
After the fix for Bug#20204783 the following failover behaviors, previously only observed with Java 5, are now exposed in Java 6+.

1st. In a failover connection configuration, if only the first server is up, a failover process tries to connect to unavailable servers for a default number of retries (120) but never falls back to the first one, not allowing it the chance to recover.

2nd. A failover event is triggered in all kinds of Exceptions while only connection failing related exceptions should do it.

3rd. In a succession of failover events in the same connection, the number of active connections keeps growing until the code exits with a "too many connections" exception.

How to repeat:
I'm attaching a code sample that exploits all three behaviors.

To observe the behavior 1 execute the sample code with one working server (the first one in the list of the configured servers).
To observe the behaviors 2 and 3, execute the code with two working servers.

Suggested fix:
-
[9 Mar 2015 21:33] Daniel So
Added the following entry to the Connector/J 5.1.35 changelog:

"The failover support by Connector/J has been refactored to be implemented independently of Connector/J's load-balancing feature. This resolves a number of issues including, for example, (1) a failover being triggered inadvertently, (2) a failover process kept trying to connect to an unavailable server (while there was an available one), and (3) the number of active connections kept growing until Connector/J threw an exception when there were successive failovers within the same connection. (The issues are regressions of Bug #75168.)"