Bug #78836 Router should provide meaningful error when no backends available
Submitted: 14 Oct 2015 21:12 Modified: 11 Feb 2016 22:02
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Router Severity:S3 (Non-critical)
Version:2.0.2 OS:Any
Assigned to: CPU Architecture:Any

[14 Oct 2015 21:12] Todd Farmer
Description:
When MySQL clients connect to a host/port pair where MySQL Server is not running, the result is a meaningful error message:

tofarmer@todd-desktop:~$ mysql -ut -P7001 --protocol=tcp
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (111)

When MySQL clients connect to MySQL Router and the configured backends are not available, the result is a more opaque error message:

tofarmer@todd-desktop:~$ mysql -ut -P7002 --protocol=tcp
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

It's too late to pretend there's no service running - the client-side TCP connection was already established.  It would be helpful to provide a meaningful error message to users as to why the connection failed.

How to repeat:
1.  Configure MySQL Router, pointing to MySQL Server backends which do not exist.
2.  Connect to MySQL Router.
3.  Compare error message to attempts to connect to a unbound port.

Suggested fix:
Provide meaningful error message when connections cannot be made, but MySQL Router is running.
[11 Feb 2016 22:02] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Router 2.0.3 release, and here's the changelog entry:

When MySQL clients connected to Router and the configured backends were
not available, the generated error (such as "ERROR 2013 (HY000): Lost
connection to MySQL server at 'reading initial communication packet',
system error: 0" was unclear. 

Now, when none of the backend
servers are available, the client receives a message similar to those
generated when MySQL clients connect to a host/port pair where MySQL
Server is not running. For example, "ERROR 2003 (HY000): Can't connect to
MySQL server on '127.0.0.1' (61)".

Thank you for the bug report.