Bug #34064 Proxy crashes in test for bug 30867
Submitted: 25 Jan 2008 18:19 Modified: 16 May 2008 14:06
Reporter: Kay Roepke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Core Severity:S1 (Critical)
Version:0.7.0 OS:MacOS (10.5.1)
Assigned to: Kay Roepke CPU Architecture:Any

[25 Jan 2008 18:19] Kay Roepke
Description:
When running the test suite, the test in ./base/t/bug_30867.test will crash the proxy instance with a SIGBUS.

How to repeat:
run make check on Mac OS X 10.5
[25 Jan 2008 18:20] Kay Roepke
Stacktrace of the crash:

Thread 1 (process 531 local thread 0x2f1f):
#0  0x0003cd03 in newkey ()
#1  0x0003e0ab in luaV_settable ()
#2  0x0003eece in luaV_execute ()
#3  0x00034c30 in luaD_call ()
#4  0x00030703 in lua_call ()
#5  0x0004b6ca in ll_require ()
#6  0x000ab563 in luaD_precall () at gstring.h:145
#7  0x000b6a0e in luaV_execute () at gstring.h:145
#8  0x000ab9a0 in luaD_call () at gstring.h:145
#9  0x000a74c1 in f_call () at gstring.h:145
#10 0x000aaeab in luaD_rawrunprotected () at gstring.h:145
#11 0x000abcc2 in luaD_pcall () at gstring.h:145
#12 0x000a7535 in lua_pcall () at gstring.h:145
#13 0x0009f4e4 in lua_register_callback (con=0x50cb20) at plugin.c:1387
#14 0x000a499b in proxy_connect_server (chas=0x508260, con=0x50cb20) at plugin.c:3649
#15 0x0005a8f0 in plugin_call (srv=0x508260, con=0x50cb20, state=1) at network-mysqld.c:1140
#16 0x0005b29a in network_mysqld_con_handle (event_fd=-1, events=18448, user_data=0x50cb20) at network-mysqld.c:1235
#17 0x0005be0e in network_mysqld_con_accept (event_fd=5, events=2, user_data=0x50c9d0) at network-mysqld.c:1829
#18 0x000701cb in event_base_loop () at gstring.h:145
#19 0x000704b9 in event_base_dispatch () at gstring.h:145
#20 0x0002ef56 in chassis_mainloop (_chas=0x508260) at chassis-mainloop.c:161
#21 0x000029c1 in main (argc=1, argv=0xbfffeeec) at chassis.c:487
[25 Jan 2008 19:04] Kay Roepke
gdb confused the symbols because Lua wasn't built with debug info.
Here's a better trace:

#0  0x00053964 in newkey (L=0x50e030, t=0x50f3d0, key=0x510040) at ltable.c:425
#1  0x00053d05 in luaH_set (L=0x50e030, t=0x50f3d0, key=0x510040) at ltable.c:503
#2  0x0005520b in luaV_settable (L=0x50e030, t=0x813eb4, key=0x510040, val=0x813ec0) at lvm.c:142
#3  0x0005672f in luaV_execute (L=0x50e030, nexeccalls=1) at lvm.c:456
#4  0x00049131 in luaD_call (L=0x50e030, func=0x80d26c, nResults=1) at ldo.c:377
#5  0x000438b5 in lua_call (L=0x50e030, nargs=1, nresults=1) at lapi.c:778
#6  0x00064626 in ll_require (L=0x50e030) at loadlib.c:484
#7  0x004914a1 in luaD_precall (L=0x50e030, func=0x80d224, nresults=0) at ldo.c:319
#8  0x004a02d7 in luaV_execute (L=0x50e030, nexeccalls=1) at lvm.c:589
#9  0x00491701 in luaD_call (L=0x50e030, func=0x80d218, nResults=0) at ldo.c:377
#10 0x0048bed9 in f_call (L=0x50e030, ud=0xbfffe92c) at lapi.c:796
#11 0x0049096e in luaD_rawrunprotected (L=0x50e030, f=0x48beaf <f_call>, ud=0xbfffe92c) at ldo.c:116
#12 0x00491a50 in luaD_pcall (L=0x50e030, func=0x48beaf <f_call>, u=0xbfffe92c, old_top=24, ef=0) at ldo.c:461
#13 0x0048bf76 in lua_pcall (L=0x50e030, nargs=0, nresults=0, errfunc=0) at lapi.c:817
#14 0x004838e4 in lua_register_callback (con=0x50cb20) at plugin.c:1387
#15 0x00488d9b in proxy_connect_server (chas=0x508260, con=0x50cb20) at plugin.c:3649
#16 0x000808f0 in plugin_call (srv=0x508260, con=0x50cb20, state=1) at network-mysqld.c:1140
#17 0x0008129a in network_mysqld_con_handle (event_fd=-1, events=-29680, user_data=0x50cb20) at network-mysqld.c:1235
#18 0x00081e0e in network_mysqld_con_accept (event_fd=5, events=2, user_data=0x50c9d0) at network-mysqld.c:1829
#19 0x000961cb in event_base_loop ()
#20 0x000964b9 in event_base_dispatch ()
#21 0x00041af6 in chassis_mainloop (_chas=0x508260) at chassis-mainloop.c:161
#22 0x000029c1 in main (argc=1, argv=0xbfffeeec) at chassis.c:487
[30 Jan 2008 14:50] Kay Roepke
The problem was that the plugins linked to liblua as well.

Only the chassis itself should link in Lua, otherwise there will be a duplicate internal static symbol Lua depends on, and random crashes will ensue.

The fix was to remove -llua from the LDFLAGS of the plugins, now everything is works as expected.
[16 May 2008 14:06] MC Brown
No documentation needed.