Bug #1161 MySQL-4.1.1 crashes when trying to access a ISAM table and have_isam set to no
Submitted: 28 Aug 2003 23:34 Modified: 28 Sep 2003 9:41
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.1 OS:Linux (Linux)
Assigned to: Sergei Golubchik CPU Architecture:Any

[28 Aug 2003 23:34] jocelyn fournier
Description:
When trying to access a ISAM table without the ISAM support, MySQL crashes.

How to repeat:
Access an ISAM table with MySQL-4.1.1 compiled without the ISAM support.

Stack trace :

0x80b9ab2 handle_segfault + 642
0x82c5ad8 pthread_sighandler + 176
0x80a788c Field_str::Field_str[not-in-charge](char*, unsigned, unsigned char*, unsigned char, Field::utype, char const*, st_table*, charset_info_st*) + 76
0x80a942d Field_string::Field_string[in-charge](char*, unsigned, unsigned char*, unsigned char, Field::utype, char const*, st_table*, charset_info_st*) + 77
0x80a59fc make_field(char*, unsigned, unsigned char*, unsigned char, unsigned, enum_field_types, charset_info_st*, Field::geometry_type, Field::utype, st_typelib*, char const*, st_table*) + 124
0x80eaad3 openfrm(char const*, char const*, unsigned, unsigned, unsigned, st_table*) + 3155
0x80e778d open_unireg_entry(THD*, st_table*, char const*, char const*, char const*) + 125
0x80e6aef open_table(THD*, char const*, char const*, char const*, bool*) + 959
0x80e7b3a open_ltable(THD*, st_table_list*, thr_lock_type) + 74
0x814d659 mysqld_extend_show_tables(THD*, char const*, char const*) + 2857
0x80cab60 mysql_execute_command(THD*) + 5376
0x80cfa38 mysql_parse(THD*, char*, unsigned) + 232
0x80c848d dispatch_command(enum_server_command, THD*, char*, unsigned) + 1021
0x80c8045 do_command(THD*) + 133
0x80c78dc handle_one_connection + 828
0x82c34fa pthread_start_thread + 218
0x82f766a thread_start + 4
[30 Aug 2003 11:31] MySQL Verification Team
Works fine for me with latest 4.1.1:

[/mnt/work/mysql-4.1]$ ./client/mysql bug
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Didn't find any fields in table 'xx'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.1-alpha-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from xx;
ERROR 1017 (HY000): Can't find file: 'xx.MYI' (errno: 2)
mysql> quit
Bye
[4 Sep 2003 13:28] jocelyn fournier
Hi,

The bug still occurs for me.
To reproduce it, download

ftp://support.mysql.com/pub/mysql/secret/isam.tar.gz

And then try :

SELECT * FROM phpads_clients;

MySQL will crash.

Regards,
  Jocelyn
[4 Sep 2003 14:09] jocelyn fournier
Here is the full backtrace BTW :

(gdb) backtrace full
#0  0x400da781 in kill () from /lib/libc.so.6
No symbol table info available.
#1  0x40034e5e in pthread_kill () from /lib/libpthread.so.0
No symbol table info available.
#2  0x08212e87 in write_core (sig=11) at stacktrace.c:220
No locals.
#3  0x081437b0 in handle_segfault (sig=11) at mysqld.cc:1578
        thd = (class THD *) 0xb
#4  0x40034f54 in pthread_sighandler () from /lib/libpthread.so.0
No symbol table info available.
#5  0x400da6b8 in sigaction () from /lib/libc.so.6
No symbol table info available.
#6  0x08178b6b in openfrm(char const*, char const*, unsigned, unsigned, unsigned, st_table*) (
    name=0xbf5ff12c "./isam/phpads_clients", alias=0x0, db_stat=39, prgflag=44, ha_open_flags=0, outparam=0x0) at table.cc:428
        i = 1
        strpos = (uchar *) 0x84df699 "\005\vDÿ\004"
        j = 1074002656
        error = 4
        rec_buff_length = 0
        n_length = 0
        int_length = 13
        records = 3
        key_parts = 1
        keys = 1
        interval_count = 1
        interval_parts = 3
        read_length = 0
        db_create_options = 3
        key_info_length = 0
        com_length = 0
        pos = 294
        index_file = "./isam/phpads_clients\0frm\0_¿\0\0\0\08\020\0\0\0\0\0\0Ôî_¿\016\t\003@àú\003@\0\0\0\0\a\0\0\0\216n\003@\a\0\0\0 f\034@ôî_¿ n\003@\0\0\0\0\0\0\0\0\004ï_¿mn\003@H\216\034@ nN\b\004ï_¿£ú\021@H\216\034@\0\0\0\04ï_¿äá\024@\a\0\0\0H\216\034@4ï_¿Ûá\024@ nN\b\a\0\0\04ï_¿~á\024@\0\0\0\08\017O\bX\022O\b\0\0\0\08\017O\bX\022O\bäó_¿\017\2041\b´\0\0\0\214ï_¿"...
        names = 0x84e18b0 "è\2324\b\baN\b"
        keynames = 0x84e1672 ""
        comment_pos = 0x84e18b0 "è\2324\b\baN\b"
        head = "ã\003\0\020", '\0' <repeats 252 times>, "\001\0\023\0&\001e\003\0\0\036\003¿\0\001\0\003\0\r\0\0\0P\0\026\0\a\0\0\0\0"
        disk_buff = (uchar *) 0x84df568 "&\001\024\023\002\024)", ' ' <repeats 40 times>
        new_field_pack_flag = 2 '\002'
        record = 0x84e6107 ""
        int_array = (const char **) 0x84e17e0
        use_hash = false
        null_field_first = false
        file = -1
        field_ptr = (class Field **) 0x84e1724
        reg_field = (class Field *) 0x0
        keyinfo = (KEY *) 0x84e1650
        key_part = (KEY_PART_INFO *) 0x0
        null_pos = (uchar *) 0x0
        null_bit = 1
        new_frm_ver = 1
        field_pack_length = 11
        _db_func_ = 0x4003fae0 "ì9\001"
        _db_file_ = 0x401c6ab0 ""
        _db_level_ = 139398928
        _db_framep_ = (char **) 0x40036c3e
        old_root = (MEM_ROOT *) 0x84d919c
        rec_per_key = (ulong *) 0xb
#7  0x08174b9e in open_unireg_entry (thd=0x84d8aa8, entry=0x84e1268, db=0x84e6060 "isam", name=0x84eaf80 "phpads_clients", 
    alias=0x84eafc8 "phpads_clients") at sql_base.cc:1286
        path = "./isam/phpads_clients\0_¿\a\0\0\0Â\0361\bÜñ_¿É2O\b\0\0\0\0>l\003@àú\003@°j\034@H\022N\b>l\003@àú\003@@ÚK\b¿\0\0\0\224ñ_¿\220ñ_¿\224ñ_¿´ñ_¿\0\0\0\0Àj\034@\0\0\0\0Äñ_¿Ó2\003@PÚK\b\0\0\0\0Äñ_¿\2251\003@\0\0\0\0@ÚK\b¿\0\0\0¨ñ\021@°j\034@ f\034@ôñ_¿Õ\0272\b@ÚK\b\003\b\0\0d\003\0\08ò_¿,ò_¿Þö_¿Üö_¿P\022N\bh\022N\bd\003\0\0"...
        error = -1084231380
        _db_func_ = 0xbf5ff31c " ÚG\b"
        _db_file_ = 0xbf5ff5fe ""
---Type <return> to continue, or q <return> to quit---
        _db_level_ = 0
        _db_framep_ = (char **) 0x0
#8  0x08173c12 in open_table(THD*, char const*, char const*, char const*, bool*) (thd=0x84d8aa8, db=0x84e6060 "isam", 
    table_name=0x84eaf80 "phpads_clients", alias=0x84eafc8 "phpads_clients", refresh=0xbf5ff5f7) at sql_base.cc:863
        table = (TABLE *) 0x84e1268
        key = "isam\0phpads_clients\0\0\0\0\0Ôó_¿Øó_\0\0\0\0\0Øó_¿\0\0\0\0\004\0\0\0üô_¿\006\0\0\0äó_¿ÖjL\bÖjL\b\200¯G\b\024ô_¿\001\003\024\b´\212M\b\005\0\0\0\024ô_¿´\212M\b´\212M\be`N\bDô_¿\0\230\023\bê\0\0\00ô_¿4ô_¿8ô_¿4ô_¿8ô_¿<ô_¿\017\0\0\0\0\222M\0´\212M\b\005\0\0\005¨\212M\b´\212M\be`N\b¤ô_¿`²\023\b^\001\0\0|ô_¿\200ô_¿\204ô_¿\200ô_¿\204ô_¿"...
        key_length = 20
        _db_func_ = 0x234 <Address 0x234 out of bounds>
        _db_file_ = 0xbf5ff3cc "üô_¿\006"
        _db_level_ = 3210736592
        _db_framep_ = (char **) 0xbf5ff3d4
#9  0x08174eb6 in open_tables(THD*, st_table_list*) (thd=0x84d8aa8, start=0x84eafd8) at sql_base.cc:1363
        tables = (TABLE_LIST *) 0x84eafd8
        refresh = false
        result = 0
        _db_func_ = 0x819a421 "\203Ä0[_]ÃU\211å\203ì(\211]ô\211uø\211}ü\213u\b\213}\024\213\206D\r"
        _db_file_ = 0x54 <Address 0x54 out of bounds>
        _db_level_ = 3210737180
        _db_framep_ = (char **) 0xbf5ff620
#10 0x081752f6 in open_and_lock_tables(THD*, st_table_list*) (thd=0x84d8aa8, tables=0x84eafd8) at sql_base.cc:1519
No locals.
#11 0x08154db2 in mysql_execute_command(THD*) (thd=0x84d8aa8) at sql_parse.cc:1736
        result = (class select_result *) 0x84d8aa8
        res = 0
        lex = (LEX *) 0x84d8d20
        tables = (TABLE_LIST *) 0x84eafd8
        select_lex = (SELECT_LEX *) 0x84d8df0
        unit = (SELECT_LEX_UNIT *) 0x84d8d2c
        _db_func_ = 0x2c0000 <Address 0x2c0000 out of bounds>
        _db_file_ = 0x2fd01ff <Address 0x2fd01ff out of bounds>
        _db_level_ = 96928853
        _db_framep_ = (char **) 0x8540720
#12 0x0815a807 in mysql_parse(THD*, char*, unsigned) (thd=0x84d8aa8, inBuf=0x84eaef0 "SELECT * FROM phpads_clients", 
    length=139300128) at sql_parse.cc:3681
        lex = (LEX *) 0x84d8d20
        _db_func_ = 0xbf5ffc88 ""
        _db_file_ = 0x0
        _db_level_ = 1075630144
        _db_framep_ = (char **) 0xbf5ff8b4
#13 0x08153aaf in dispatch_command(enum_server_command, THD*, char*, unsigned) (command=COM_QUERY, thd=0x84d8aa8, 
    packet=0x84e1c19 "SELECT * FROM phpads_clients", packet_length=29) at sql_parse.cc:1285
        net = (NET *) 0x84d8ab4
        error = false
        slow_command = false
        _db_func_ = 0xbf5ff96c "¨\212M\b\v"
        _db_file_ = 0xbf5ff970 "\v"
        _db_level_ = 3210738028
        _db_framep_ = (char **) 0x401c8e48
        start_of_query = 139299496
#14 0x0815335e in do_command(THD*) (thd=0x84d8aa8) at sql_parse.cc:1120
        packet = 0x84e1c18 "\003SELECT * FROM phpads_clients"
        old_timeout = 30
        packet_length = 29
        net = (NET *) 0x84d8ab4
        command = COM_QUERY
        _db_func_ = 0x81327b8 "\213]ü\211ì]Ã\220U\211å\203ì8\211]ü\213]\b\211\034$èl"
        _db_file_ = 0x84d9658 "8\002N\b"
        _db_level_ = 4096
        _db_framep_ = (char **) 0x1000
#15 0x08152853 in handle_one_connection (arg=0x0) at sql_parse.cc:899
        error = 11
        net = (NET *) 0x84d8ab4
        thd = (class THD *) 0x84d8aa8
        launch_time = 0
        set = {__val = {0 <repeats 32 times>}}
[22 Sep 2003 0:13] MySQL Verification Team
For to complete: ISAM tables won't be supported anymore
on 4.1.XX.
[28 Sep 2003 9:41] Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

In fact, ISAM tables will be still supported at least up to MySQL 5.
But in 4.1 they will not be compiled in by default.

As for this particular bug, the reason of crash was old 3.22.frm file,
not ISAM table handler.
Fixed in 4.1.1