[CONJ-230] Wrong host address in exception message on failover Created: 2015-12-02  Updated: 2016-01-12  Resolved: 2016-01-12

Status: Closed
Project: MariaDB Connector/J
Component/s: Failover
Affects Version/s: None
Fix Version/s: 1.3.4

Type: Bug Priority: Minor
Reporter: Soichiro Kashima Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

MariaDB 10.1, Connector/J 1.3.2



 Description   

I'm trying to use failover option for Galera Cluster.
URL is like this:

jdbc:mysql:failover://192.168.33.11,192.168.33.12,192.168.33.13/test?autoReconnect=true

And when failover occurred in a transaction with connection to 192.168.33.13, the driver threw an exception with this message:

Communications link failure with primary host 192.168.33.11:3306. unexpected end of stream, read 0 bytes from 4.  Driver as successfully reconnect connection

But "192.168.33.11" is not the host which caused "communications link failure".
It should be "Communications link failure with primary host 192.168.33.13:3306".
"192.168.33.11" is the new, active master host.
(I have checked it with query log.)

I think the cause of this problem is in FailoverProxy#handleFailover().
The message above is created in listener.throwFailoverMessage(),
and in throwFailoverMessage(), the failed host address is retrieved from currentProtocol.getHostAddress().
However, currentProtocol is already updated in listener.handleFailover().

  FailoverProxy#handleFailOver()
  -> AbstractMastersListener#handleFailover()
  -> MastersFailoverListener#primaryFail()
  -> MastersFailoverListener#reconnectFailedConnection()
  -> MasterProtocol#loop()
  -> MastersFailoverListener#foundActiveMaster()

I found this problem with multi master (MastersFailoverListener),
but it might happen with master/slave replication (MastersSlavesListener)
because it has very similar implementation.



 Comments   
Comment by Diego Dupin [ 2015-12-04 ]

you are right, message concern the new host.

Comment by Diego Dupin [ 2015-12-07 ]

closing this by mistake. reopen it

Comment by Diego Dupin [ 2016-01-12 ]

Corrected in 1.3.4

Generated at Thu Feb 08 03:14:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.