Bug #66399 connected_clients is counted even if the backend is down
Submitted: 15 Aug 2012 10:46 Modified: 9 Jan 2015 10:16
Reporter: Hailin Hu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Core Severity:S2 (Serious)
Version:0.8.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[15 Aug 2012 10:46] Hailin Hu
Description:
connected_clients is counted before the actual connect trying.

if the backend is down, connected_clients is stilled counted, which would cause the default SQF proxy algorithm working improperly.

How to repeat:
for proxy, load 2 proxy backends, one is up and the other is down.
for admin, use the admin.lua in source package.

try to connect and disconnect multiple times to have mysql-proxy trying to connecting every backends, then log into admin console to check backends states.
even if a backend is down, connected_clients is increased.

Suggested fix:
$ diff plugins/proxy/proxy-plugin.c plugins/proxy/proxy-plugin.c.patched
1628,1629d1627
< 		st->backend->connected_clients++;
< 
1635a1634
> 		    st->backend->connected_clients++;
[22 Feb 2013 18:18] Sveta Smirnova
Thank you for the report.

Verified as described.
[18 Dec 2013 21:23] Paul DuBois
Noted in 0.8.4 changelog.

The connected_clients value was incremented even if the backend was
down.