← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: [MySQL Proxy] Connection Close and ERROR 2013

 

Hi!

On Jun 11, 2009, at 10:59 AM, Erwan Ben Souiden wrote:
I got a little problem with mysql-proxy.
Basically, when I try to create several connections via my
mysql-proxy, I have no problem until the connection where I have the
following error :
$ mysql -ulabynocle -p --host=127.0.0.1 --port=3318
Enter password:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading final
connect information', system error: 0

When I check the mysql-proxy log, I have the following line :
2009-06-11 09:52:27: (debug) [network-mysqld.c:784]: error on a
connection (fd: -1 event: 0). closing client connection.

I guess we need to work on that error message to output more information. Unfortunately this isn't telling us much, apart from what we already know: The server closed the connection. :|

Then I try another new connection and I have no problem.
But the problem comes back then ! I guess when I have the bug, a
connection is closed then I can create a new one. This is why I
believe it works when I retry...
Besides I have no error in my /var/log/message.

Just to clarify, MySQL Proxy won't log anything to /var/log/message if it writes its own log file. Neither will mysqld. Proxy can use use syslog (--log-use-syslog), however I wouldn't recommend it because the noise in /var/log/messages usually makes it hard to see what's going on, unless you direct it to its own file, but then what's the point of using syslog :)

My configuration :
mysql-proxy v 0.7.1 (from
http://code.launchpad.net/mysql-proxy/0.7/0.7.1/+download/mysql-proxy-0.7.1.tar.gz)
compiled with no particular option
rw-splitting.lua script has been patched thanks to the following patch
: https://code.launchpad.net/~diego-fmpwizard/mysql-proxy/ bug-43424/+merge/4259

Ok, makes sense.
Have you tried this with a binary from http://dev.mysql.com/downloads/mysql-proxy? Shouldn't make a difference, but it's worth a try.

However, what I think is going on might be related to this bug report: http://bugs.mysql.com/bug.php?id=28359
The gist is that this error can be caused by exceeding the connect_timeout (the default is rather small) which causes the server to just close the connection leading to error 2013 on the client. What is it set to in your mysqlds? Which versions are you running? (mmmh I think we should log the server versions we connect to, I'll file a feature request.)

Are your backend servers rather busy? If so that might lead to what's described in the bug report mentioned above. If not, it might be a problem with how we assemble the handshake packet, or a more general problem with the connection pool, but all of that is pure speculation at this point.

How often does this occur? If it's quite frequent, could you get a trace for that connection using wireshark so we can see what the actual packets are? (Again, maybe it's worthwhile for us to include an option to dump the traffic for each connection to a file - that could greatly help with debugging!)

How I run mysql-proxy :
export LUA_PATH="/usr/local/mysql-proxy-0.7.1/lib/mysql-proxy/ lua/?.lua"
/usr/local/mysql-proxy-0.7.1/sbin/mysql-proxy --proxy-address=:3318
--proxy-lua-script=/usr/local/mysql-proxy-0.7.1/lib/mysql-proxy/lua/ rw-splitting.lua
--proxy-backend-addresses=10.0.0.42:3306
--proxy-read-only-backend-addresses=127.0.0.1:3308
--admin-address=127.0.0.1:4041 --log-file=/var/log/mysql-proxy.log
--log-level=debug --max-open-files=1024
--pid-file=/var/run/mysql-proxy.pid >> $LUALOG &

I'm assuming you are aware of the problems rw-splitting.lua has. If not, or if you've encountered any shortcomings/bugs/problems with it that aren't already known, please refer to http://forge.mysql.org/wiki/MySQL_Proxy_RW_Splitting . Feel free to edit that page, too. That will help us and others to hopefully improve it going forward.

I have no clue so any will be greatly appreciated :)
If you need more info/log or something else let me know.
And please forgive my poor english level :)

Why? It's fine! :)

Thank you for your report!

cheers,
-k
--
Kay Roepke
Software Engineer, MySQL Enterprise Tools

Sun Microsystems GmbH    Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer:    Thomas Schroeder,  Wolfang Engels,  Wolf Frenkel
Vorsitz d. Aufs.rat.: Martin Haering                    HRB MUC 161028




Follow ups

References