Bug #38861 EXAMPLE plugin crashes the server on Mac OSX
Submitted: 18 Aug 2008 15:24 Modified: 17 Oct 2014 19:18
Reporter: Giuseppe Maxia Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S1 (Critical)
Version:5.1.28 OS:MacOS (10.5)
Assigned to: CPU Architecture:Any
Tags: crash, plugin

[18 Aug 2008 15:24] Giuseppe Maxia
Description:
using the Example plugin crashes the server on Mac OSX

Server 5.1.28, compiled from source tree mysql-5.1, r2679

compiled with the following script:
#! /bin/sh

path=`dirname $0`
. "$path/SETUP.sh"

extra_flags=" $fast_cflags $max_cflags -g"
extra_configs=" $max_no_ndb_configs"

. "$path/FINISH.sh"

Running the queries below, the server crashes

INSTALL PLUGIN example SONAME 'ha_example.so';
DROP TABLE if exists t1;
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
SELECT * FROM t1;

080818 18:02:54 - mysqld got signal 8 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=1
max_threads=151
threads_connected=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 59948 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x1027200
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0xb0062f54 thread_stack 0x30000
0   mysqld                              0x003e9864 my_print_stacktrace + 52^@
1   mysqld                              0x000d8c79 handle_segfault + 1001^@
2   libSystem.B.dylib                   0x9039909b _sigtramp + 43^@
3   ???                                 0xffffffff 0x0 + 4294967295^@
4   ha_example.so                       0x00b13dc6 _ZN10ha_example4openEPKcij + 70^@
5   mysqld                              0x001d5c81 _ZN7handler7ha_openEP8st_tablePKcii + 49^@
6   mysqld                              0x00138066 _Z21open_table_from_shareP3THDP14st_table_sharePKcjjjP8st_tableb + 15
74^@
7   mysqld                              0x0012e570 _Z11lock_tablesP3THDP10TABLE_LISTjPb + 2128^@
8   mysqld                              0x001322f3 _Z10open_tableP3THDP10TABLE_LISTP11st_mem_rootPbj + 1971^@
9   mysqld                              0x00133056 _Z11open_tablesP3THDPP10TABLE_LISTPjj + 1446^@
10  mysqld                              0x0013342a _Z28open_and_lock_tables_derivedP3THDP10TABLE_LISTb + 58^@
11  mysqld                              0x000e447c _ZN13st_select_lex18convert_right_joinEv + 396^@
12  mysqld                              0x000e9bd0 _Z21mysql_execute_commandP3THD + 9056^@
13  mysqld                              0x000f2336 _Z11mysql_parseP3THDPKcjPS2_ + 566^@
14  mysqld                              0x000f3781 _Z16dispatch_command19enum_server_commandP3THDPcj + 5153^@
15  mysqld                              0x000f3d79 _Z10do_commandP3THD + 249^@
16  mysqld                              0x000e085a handle_one_connection + 1514^@
17  libSystem.B.dylib                   0x9035d6f5 _pthread_start + 321^@
18  libSystem.B.dylib                   0x9035d5b2 thread_start + 34^@
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x106a810 is an invalid pointer
thd->thread_id=1
thd->killed=NOT_KILLED

After the crash, the server does not recover. Any subsequent attempt at using the server crashes it again.

How to repeat:
INSTALL PLUGIN example SONAME 'ha_example.so';
DROP TABLE if exists t1;
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
SELECT * FROM t1;

Suggested fix:
N/A
[19 Aug 2008 8:12] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior on Mac OSX 10.5. Please provide output of  `file lib/mysql/plugin/ha_example*`
[19 Aug 2008 8:25] Giuseppe Maxia
Sveta,
as requested:

$ file lib/mysql/plugin/ha_example*
lib/mysql/plugin/ha_example.0.0.0.so: Mach-O bundle i386
lib/mysql/plugin/ha_example.0.so:     Mach-O bundle i386
lib/mysql/plugin/ha_example.a:        current ar archive random library
lib/mysql/plugin/ha_example.la:       ASCII English text
lib/mysql/plugin/ha_example.so:       Mach-O bundle i386
[19 Aug 2008 9:56] Sveta Smirnova
Thank you for the feedback.

Same output as in mine environment. Could you please upload mysqld binary, core file and full error log.
[19 Aug 2008 11:03] Giuseppe Maxia
Uploaded file bug_38861.tar.bz2 to ftp site.
It contains the binary file and the error log.

Note:
* although the error log mentions a core file, none was produced (or I could not find any)
* the bug can also be reproduced by running the test suite with the "plugin" test.
[19 Aug 2008 14:45] Sveta Smirnova
Core file should be in /cores directory
[19 Aug 2008 16:48] Giuseppe Maxia
sent core file to the FTP site 
xcore_bug_38861.tar.bz2
[24 Aug 2008 17:59] Geert Vanderkelen
Reproduced using 5.1.28-debug-log (from bzr) on Mac OS 10.5.4/Intel. So I guess this is verified.

0   mysqld                              0x00580547 my_print_stacktrace + 45
1   mysqld                              0x000f40bf handle_segfault + 839
2   libSystem.B.dylib                   0x90ee209b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   ha_example.so                       0x020430e2 0x0 + 33829090
5   ha_example.so                       0x02043485 _ZN10ha_example4openEPKcij + 87
6   mysqld                              0x002390ac _ZN7handler7ha_openEP8st_tablePKcii + 342
7   mysqld                              0x0016729e _Z21open_table_from_shareP3THDP14st_table_sharePKcjjjP8st_ta
bleb + 2824
8   mysqld                              0x0015e310 _Z8is_equalPK19st_mysql_lex_stringS1_ + 1462
9   mysqld                              0x00160f81 _Z10open_tableP3THDP10TABLE_LISTP11st_mem_rootPbj + 3953
10  mysqld                              0x00161b08 _Z11open_tablesP3THDPP10TABLE_LISTPjj + 964
11  mysqld                              0x00162360 _Z28open_and_lock_tables_derivedP3THDP10TABLE_LISTb + 156
12  mysqld                              0x001183fe _Z20open_and_lock_tablesP3THDP10TABLE_LIST + 32
13  mysqld                              0x0010513d _Z20prepare_schema_tableP3THDP6st_lexP11Table_ident18enum_sc
hema_tables + 1423
14  mysqld                              0x0010bb52 _Z21mysql_execute_commandP3THD + 2232
15  mysqld                              0x001155cf _Z11mysql_parseP3THDPKcjPS2_ + 585
16  mysqld                              0x001162e7 _Z16dispatch_command19enum_server_commandP3THDPcj + 2913
17  mysqld                              0x001175ce _Z10do_commandP3THD + 652
18  mysqld                              0x00103190 handle_one_connection + 320
19  libSystem.B.dylib                   0x90ea66f5 _pthread_start + 321
20  libSystem.B.dylib                   0x90ea65b2 thread_start + 34
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x1079e28 = SELECT * FROM t1
thd->thread_id=1
thd->killed=NOT_KILLED
[24 Aug 2008 20:45] Giuseppe Maxia
The bug can be reproduced since 5.1.19, when Bug#25659 was fixed.
[26 Aug 2008 1:34] Timothy Smith
Triage: CHECKED
[17 Oct 2014 19:18] Sveta Smirnova
Posted by developer:
 
Not reproducible in version 5.6