Bug #54337 mysql-proxy crashes when connection is closed before login
Submitted: 8 Jun 2010 14:07 Modified: 8 Jun 2010 20:52
Reporter: Joseph Breu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Proxy Severity:S1 (Critical)
Version:0.8 OS:Linux (RHEL 5.3)
Assigned to: Assigned Account CPU Architecture:Any

[8 Jun 2010 14:07] Joseph Breu
Description:
When running mysql-proxy behind a load balanced VIP the proxy crashes when the CSS performs its TCP health check.  This can also be reproduced from the command line.

The backtrace from the crash is pasted below:

 /opt/mysql_proxy/sbin/mysql-proxy --proxy-lua-script=/opt/mysql_proxy/share/mysql-proxy/rw-splitting.lua --proxy-address=192.168.100.69:3306 --proxy-read-only-backend-addresses=192.168.100.70:3306 --proxy-backend-addresses=192.168.100.78:3306 --log-backtrace-on-crash --log-level=debug
2010-06-08 09:02:07: (message) mysql-proxy 0.8.0 started
2010-06-08 09:02:07: (debug) chassis-limits.c:75: current RLIMIT_NOFILE = 1024 (hard: 1024)
2010-06-08 09:02:07: (debug) chassis-limits.c:79: trying to set new RLIMIT_NOFILE = 8192 (hard: 1024)
2010-06-08 09:02:07: (critical) chassis-limits.c:81: could not raise RLIMIT_NOFILE to 8192, Invalid argument (22). Current limit still 1024.
2010-06-08 09:02:07: (message) proxy listening on port 192.168.100.69:3306
2010-06-08 09:02:07: (message) added read/write backend: 192.168.100.78:3306
2010-06-08 09:02:07: (message) added read-only backend: 192.168.100.70:3306
#0  0x00000036f540e005 in waitpid () from /lib64/libpthread.so.0
#1  0x00002ac880a95b17 in IA__g_on_error_stack_trace (
#2  0x0000000000403878 in sigsegv_handler (signum=<value optimized out>)
#3  <signal handler called>
#4  0x00002ac87fe1a4d7 in network_connection_pool_add (pool=0x1162ab40, 
#5  0x00002ac87fe1a726 in network_connection_pool_lua_add_connection (
#6  0x00002ac87fe1578d in proxy_connection_set (L=0x11632d80)
#7  0x00002ac880257c09 in luaD_precall (L=0x11632d80, func=0x11637c80, 
#8  0x00002ac880257d29 in luaD_call (L=0x11632d80, func=0x11637c80, nResults=0)
#9  0x00002ac880260345 in luaV_settable (L=0x11632d80, t=0x11637c50, 
#10 0x00002ac880260dea in luaV_execute (L=0x11632d80, nexeccalls=1)
#11 0x00002ac880257d3a in luaD_call (L=0x11632d80, func=0x11637c30, nResults=1)
#12 0x00002ac88025399b in f_call (L=0x7fff78c10230, ud=<value optimized out>)
#13 0x00002ac8802574de in luaD_rawrunprotected (L=0x11632d80, 
#14 0x00002ac880257548 in luaD_pcall (L=0x7fff78c10230, func=0, u=0x1f9, 
#15 0x00002ac880253837 in lua_pcall (L=0x11632d80, nargs=0, nresults=1, 
#16 0x00002ac88116a05e in proxy_disconnect_client (chas=<value optimized out>, 
#17 0x00002ac87fe113bc in plugin_call_cleanup (srv=0x11615f00, con=0x1162c3f0)
#18 0x00002ac87fe12057 in network_mysqld_con_handle (event_fd=11, events=2, 
#19 0x00002ac88002c6ba in event_base_loop (base=0x11623270, flags=0)
#20 0x00002ac88002c755 in event_base_dispatch (event_base=0x7fff78c10230)
#21 0x00002ac87fc050a9 in chassis_event_thread_loop (event_thread=0x11617490)
#22 0x00002ac87fc04b9f in chassis_mainloop (_chas=<value optimized out>)
#23 0x0000000000403521 in main_cmdline (argc=1, argv=0x7fff78c11048)
#24 0x000000000040383d in main (argc=2025914928, argv=0x0) at chassis.c:1113
Aborted

How to repeat:

This is easily repeatable.  Start the proxy up and telnet to the ip:port from another session.  Close the session using ctrl-] and the proxy will crash.
[8 Jun 2010 20:52] Sveta Smirnova
Thank you for the report.

Verified as described. Starting with rw-splitting.lua is required to repeat the problem.