Bug #35216 unhandled state: 16 when using UNIX socket
Submitted: 11 Mar 2008 14:47 Modified: 3 Jun 2009 15:19
Reporter: Matthew LeSieur Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Core Severity:S3 (Non-critical)
Version:0.6.1 OS:Solaris (Solaris 9, SPARC 64-bit)
Assigned to: Kay Roepke CPU Architecture:Any

[11 Mar 2008 14:47] Matthew LeSieur
Description:
I am testing mysql-proxy for use on our web server, which hosts a couple hundred websites. We have about 100 databases on our MySQL server. When I put mysql-proxy between the websites and MySQL server, mysql-proxy crashes after running for about an hour. The error message is:

network-mysqld.c.972: unhandled state: 16

Also, I see many of these errors, but mysql-proxy does not crash:

network-mysqld.c.1648: can't convert addr-type 1 into a string

Here is the command-line for mysql-proxy:

# mysql-proxy --proxy-address=/tmp/mysql.sock --admin-address=127.0.0.1:4042 -
-proxy-backend-addresses=127.0.0.1:3307 --daemon

This is the package I installed mysql-proxy from:
mysql-proxy-0.6.1-solaris9-sparc-32bit.tar.gz

Also, just to give the whole story, I am also running another mysql-proxy process to handle port 3306. I had no errors with this mysql-proxy process. Here is the command line:

# mysql-proxy --proxy-address=0.0.0.0:3306 --admin-address=127.0.0.1:4041 --proxy
-backend-addresses=127.0.0.1:3307 --daemon 

How to repeat:
This is repeatable by starting the proxy again, between the clients and the MySQL server, an waiting for it to crash.

Suggested fix:
From a reply to my forum post from Chris Calender:
http://forums.mysql.com/read.php?146,199394,199824#msg-199824

Hi Matt,

This kind of seems like a problem with Proxy and Solaris. I've seen at least one other report of this error in the forums, and that was with Solaris also.

Further, upon looking at the code, and where that message is printed out, I see it is in the network_mysqld_con_accept() function. In that function, there is a case for AF_INET, and then all others get the error. Perhaps there needs to be a case for AF_UNIX and/or AF_LOCAL (but that's speculation on my part).

What I'd do is file a bug report about this, with everything you've mentioned here. And hopefully that will give enough info to the developers to help track this problem down.

http://bugs.mysql.com/report.php

You should also post the bug # here also, once you'vee completed it.

Best regards,
Chris
[12 Mar 2008 13:10] Matthew LeSieur
Sorry, I mistakenly listed the OS at 32-bit.  It is a 64-bit Solaris 10 install on SPARC.
[12 Mar 2008 13:12] Matthew LeSieur
Sorry again, my last comment said Solaris 10 when I should have said Solaris 9.
[18 Mar 2008 11:55] Sveta Smirnova
Thank you for the report.

Error "network-mysqld.c.1648: can't convert addr-type 1 into a string" verified as described both on Mac and Solaris. Another error is not repeatable for me.
[18 Mar 2008 21:04] Kay Roepke
Matthew,

do you have more information about the crash you observed (a core dump, stacktrace, anything)?

The other issue is the missing "case" as noted, yes.

Thanks,
Kay
[24 Mar 2008 18:13] Matthew LeSieur
Kay,
  I don't have any core files or stack traces yet.  It is on a production system, so any window for doing work on it are few and small.  I hope to have some time this week or the upcoming weekend.  One thing to note is that we were using the MySQL 4.1 libraries (built into PHP 4) to access the MySQL 5.0 server.  I don't know if that might have something to do with it.  I upgraded the MySQL client libraries and rebuilt PHP so that it is now using MySQL 5.0.  Once I get to try MySQL proxy again, I will post more information.

Thanks
Matt
[4 Apr 2008 14:07] Alex Zakharenko
I have the same problem
mysql-proxy version 6.1
Fedora Core Linux 

many messages like 
"network-mysqld.c.1645: can't convert addr-type 1 into a string"
and then 
"network-mysqld.c.969: unhandled state: 16"
[4 Apr 2008 14:09] Alex Zakharenko
OS: Fedora Core 6, 64-bit
[8 Apr 2008 11:34] Bartek okan
the same problem here

fbsd 7 / amd64 

0.6.1
[9 Apr 2008 3:38] Diego Medina
the "can't convert addr-type 1 into a string" message has been fixed on 0.7.0 (from svn)
[2 May 2008 13:31] Juan Segarra Montesinos
Hi all. About the error:

network-mysqld.c.972: unhandled state: 16

We experienced the same problem and discovered that was happening when a connection to proxy was finished with RST instead of a FIN packet. With FIN packet all works fine.

Hope this helps.

Regards :-)
[29 Jul 2008 5:15] Kay Roepke
Juan,

thanks for the extra information!
In fact, this is easily triggered by using nmap on the proxy port.
[29 Jul 2008 8:03] Kay Roepke
A fix has been committed.
It now checks for illegal sa_family values and ignores unknown ones.
Also it will not call a plugin function, if the connection is in an error state (which happens directly after a network error occurs). Instead it will close the client connection (the disconnect_client lua function will still be called).

The log level for these messages have been reduced to warning and debug, respectively.
[24 Feb 2009 16:33] Matthew Boehm
Running M/P 0.5.1 on RHEL 5.3

[root@15000Dmys01 mysql-proxy]# mysql-proxy \
--proxy-address=/var/lib/mysql/proxy.sock \
--proxy-backend-addresses=/var/lib/mysql/mysql.sock myluascript.lua

network-mysqld.c.1671: can't convert addr-type 1 into a string
network-mysqld.c.1671: can't convert addr-type 1 into a string
network-mysqld.c.1671: can't convert addr-type 1 into a string
network-mysqld.c.1671: can't convert addr-type 1 into a string

Each time someone connects I get 1 line above. Query processes just fine; just don't expect to see something like this.
[24 Feb 2009 16:34] Matthew Boehm
I'm sorry, I'm running 0.6.1 (fat-fingered mistake)
[3 Jun 2009 15:19] Kay Roepke
The fix for this has been released as part of MySQL Proxy 0.7.1.