Bug #35295 Proxy fails to skip unreachable backend
Submitted: 14 Mar 2008 15:09 Modified: 21 Jan 2009 12:20
Reporter: Kay Roepke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Core Severity:S1 (Critical)
Version:0.6.1 OS:Any
Assigned to: CPU Architecture:Any

[14 Mar 2008 15:09] Kay Roepke
Description:
In a Master-Master replication setup use the proxy to provide High-Availability:

When the first master fails the queries should go to the second instance. Clients would need to reconnect, but the proxy would skip the unreachable first backend automatically.
With 0.6.1 onward this fails, because the proxy would return an error to the client instead of trying the other backend.

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

How to repeat:
Set up a master-master replication scenario (say on ports 20001 and 20002).
Start the proxy with:

mysql-proxy --proxy-backend-addresses=127.0.0.1:20001 --proxy-backend-adresses=127.0.0.1:20002

Connect with the mysql client to the default proxy port, execute a query.
Shutdown the first mysqld instance on port 20001.
Execute another query. This will fail with:

mysql> select * from foo;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
ERROR: 
Can't connect to the server

It should skip the first backend on port 20001 and connect to 20002 but always reports an error.

Suggested fix:
0.6.0 -> 0.6.1 introduced a new if-block in network-mysqld-proxy.c (starting in line 3665).
That code should take into account that there are more backends to connect to.
[5 Sep 2008 19:56] Sveta Smirnova
Bug #39272 was marked as duplicate of this one.

Please also consider if eary reported bug #34793 should be marked as duplicate too.
[21 Jan 2009 12:20] MC Brown
A note has been added to the 0.7.0 changelog: 

When using mysql-proxy in a master-master replication scenario, a failure in one of the replication masters would fail to be identified by the proxy and connections would not be redirected to the other master.
[10 Feb 2009 12:19] v e
Hi,

Can you please tell me if this bug  has been resolved and 
also the revision of mysql-proxy 0.6.1 in which it has been resolved

Thanks in advance