Bug #1295 mysqld crash on MyiSAM compressed table
Submitted: 16 Sep 2003 4:34 Modified: 8 Dec 2003 4:01
Reporter: Martin Mokrejs Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:4.0.15 OS:Linux (Linux 2.4.19)
Assigned to: Michael Widenius CPU Architecture:Any

[16 Sep 2003 4:34] Martin Mokrejs
Description:
I have found 4.0.15 on linux claims many MyISAM compressed tables are crashed. When I shutdown mysqld and start 4.0.13 for example, or 4.0.9 they are fine.
In this bug report I report mysqld crash on some tables. The big issue I'll report separately.

/usr/local/mysql/bin/resolve_stack_dump -s ./symbols -n ./stack
0x8070640 handle_segfault + 420
0x8288108 pthread_sighandler + 184
0x8258d36 mi_checksum + 150
0x825bcd9 chk_data_link + 2993
0x80c4d7d check__9ha_myisamP3THDP15st_ha_check_opt + 597
0x80d2ca5 mysql_admin_table__FP3THDP13st_table_listP15st_ha_check_optPCc13thr_lock_typebUiPFP3THDP13st_table_listP15st_ha_check_opt_iPM7h + 1553
0x80d3115 mysql_check_table__FP3THDP13st_table_listP15st_ha_check_opt + 69
0x807be02 mysql_execute_command__Fv + 5390
0x807e895 mysql_parse__FP3THDPcUi + 153
0x8079e03 dispatch_command__F19enum_server_commandP3THDPcUi + 1435
0x807985d do_command__FP3THD + 165
0x807904f handle_one_connection + 631
0x82858bc pthread_start_thread + 220
0x82bb07a thread_start + 4

mysql@jerboas:~$ /usr/local/mysql-standard-4.0.15-pc-linux-i686/bin/mysql -p Bhalodurans
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 43 to server version: 4.0.15-standard-log

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

mysql> check table rep;
ERROR 2013: Lost connection to MySQL server during query
mysql> 

When I use client from remote machine, it works! I tried to connect from local machine both via localhost and via eth, but both make mysqld crash.

bioadmin@bontebok$ /usr/local/mysql-standard-4.0.13-dec-osf5.1-alphaev67/bin/mysql Bhalodurans
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4890 to server version: 4.0.15-standard

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

mysql> check table rep;
+-----------------+-------+----------+----------+
| Table           | Op    | Msg_type | Msg_text |
+-----------------+-------+----------+----------+
| Bhalodurans.rep | check | status   | OK       |
+-----------------+-------+----------+----------+
1 row in set (0.95 sec)

mysql> 

How to repeat:
see above
[16 Sep 2003 4:53] Martin Mokrejs
Ahh, sorry, please ignore the notes about crash not happening from remote machine(I forgot the -h option).
[16 Sep 2003 4:55] Martin Mokrejs
bioadmin@bontebok$ /usr/local/mysql-standard-4.0.13-dec-osf5.1-alphaev67/bin/mysql -hjerboas Bhalodurans
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 'blast'
Didn't find any fields in table 'blast_data'
Didn't find any fields in table 'blastindex'
Didn't find any fields in table 'blimps'
Didn't find any fields in table 'blimps_data'
Didn't find any fields in table 'cogs'
Didn't find any fields in table 'cogs_data'
Didn't find any fields in table 'contig_data'
Didn't find any fields in table 'ecnum'
Didn't find any fields in table 'funcat'
Didn't find any fields in table 'funcat_data'
Didn't find any fields in table 'intragenome'
Didn't find any fields in table 'intragenome_data'
Didn't find any fields in table 'known3d1'
Didn't find any fields in table 'known3d_data'
Didn't find any fields in table 'pfam'
Didn't find any fields in table 'pfam_data'
Didn't find any fields in table 'pirkw'
Didn't find any fields in table 'pros_data'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.15-log

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

mysql> check table rep;

This cause little bit different stack trace from REMOTE machine:

0x80cb18f handle_segfault + 423
0x4002a75a _end + 937595154
0x401912f2 _end + 939064490
0x401902ca _end + 939060354
0x81843f2 my_no_flags_free + 22
0x816d496 mi_close + 326
0x81263c2 close__9ha_myisam + 34
0x80ee59d closefrm__FP8st_table + 45
0x80ebfd8 free_cache_entry__FP8st_table + 36
0x8189625 hash_delete + 813
0x80ec1d0 close_thread_table__FP3THDPP8st_table + 72
0x80ec110 close_thread_tables__FP3THDb + 124
0x812cc79 mysql_admin_table__FP3THDP13st_table_listP15st_ha_check_optPCc13thr_lock_typebUiPFP3THDP13st_table_listP15st_ha_check_opt_iPM7h + 2073
0x812f9ab mysql_check_table__FP3THDP13st_table_listP15st_ha_check_opt + 63
0x80d7bb9 mysql_execute_command__Fv + 5373
0x80da3e5 mysql_parse__FP3THDPcUi + 565
0x80d5c39 dispatch_command__F19enum_server_commandP3THDPcUi + 1453
0x80db90d do_command__FP3THD + 153
0x80d4ebe handle_one_connection + 634
0x40024d53 _end + 937572107
0x401ea477 _end + 939429423
[16 Sep 2003 5:12] Martin Mokrejs
This bug can be fixed with patch from Sinisa. Also myisamchk has to be fixed(no patch available). 

From: Sinisa Milivojevic <sinisa@mysql.com>
To: mmokrejs@natur.cuni.cz
Date: Thu, 28 Aug 2003 21:49:29 +0300
Subject: Re: MyISAM crash on packed table (was setrlimit crash)

This is a bug fix that fixes the error.

===== sql/sql_table.cc 1.166 vs edited =====
*** /tmp/sql_table.cc-1.166-3189        Sat Aug 23 12:26:06 2003
--- edited/sql/sql_table.cc     Thu Aug 28 21:46:50 2003
***************
*** 1418,1424 ****
    DBUG_ENTER("mysql_check_table");
    DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
                                "check", lock_type,
!                               0, HA_OPEN_FOR_REPAIR, 0,
                                &handler::check));
  }
  
--- 1418,1424 ----
    DBUG_ENTER("mysql_check_table");
    DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
                                "check", lock_type,
!                               1, HA_OPEN_FOR_REPAIR, 0,
                                &handler::check));
  }

With 4.0.15 patched one receives:

mysql> check table rep;
+-----------------+-------+----------+--------------------------------------+
| Table           | Op    | Msg_type | Msg_text                             |
+-----------------+-------+----------+--------------------------------------+
| Bhalodurans.rep | check | error    | Table 'Bhalodurans.rep' is read only |
+-----------------+-------+----------+--------------------------------------+

Actually is not very descriptive. Is the table crashed or not?
[16 Sep 2003 5:15] Martin Mokrejs
Crashed tables are not reported as crashed with thsi patch, probably that's why Sinisa did not apply the patch. But, as I know, he left for 4 weeks ... :(

mysql -hjerboas Bhalodurans
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 'blast'
Didn't find any fields in table 'blast_data'
Didn't find any fields in table 'blastindex'
Didn't find any fields in table 'blimps'
Didn't find any fields in table 'blimps_data'
Didn't find any fields in table 'cogs'
Didn't find any fields in table 'cogs_data'
Didn't find any fields in table 'contig_data'
Didn't find any fields in table 'ecnum'
Didn't find any fields in table 'funcat'
Didn't find any fields in table 'funcat_data'
Didn't find any fields in table 'intragenome'
Didn't find any fields in table 'intragenome_data'
Didn't find any fields in table 'known3d_data'
Didn't find any fields in table 'pfam'
Didn't find any fields in table 'pfam_data'
Didn't find any fields in table 'pirkw'
Didn't find any fields in table 'pros_data'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 96 to server version: 4.0.15-log

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

mysql> check table known3d_data;
+--------------------------+-------+----------+-----------------------------------------------+
| Table                    | Op    | Msg_type | Msg_text                                      |
+--------------------------+-------+----------+-----------------------------------------------+
| Bhalodurans.known3d_data | check | error    | Table 'Bhalodurans.known3d_data' is read only |
+--------------------------+-------+----------+-----------------------------------------------+
1 row in set (0.00 sec)

mysql> repair table known3d_data;
+--------------------------+--------+----------+-----------------------------------+
| Table                    | Op     | Msg_type | Msg_text                          |
+--------------------------+--------+----------+-----------------------------------+
| Bhalodurans.known3d_data | repair | error    | Table 'known3d_data' is read only |
+--------------------------+--------+----------+-----------------------------------+
1 row in set (0.00 sec)

mysql>
[18 Sep 2003 5:10] Indrek Siitan
We are aware of this issue and working on it.
[24 Sep 2003 4:23] Michael Widenius
I have now fixed one bug with compressed tables:
In 4.0.14 we introduced a bug in overflow checking that causes MySQL to believe that some compressed tables with blobs where corrupted. (See #1304 for details)

The fix will be in 4.0.16.

Can you please test if the fix also fixes this issue.

Regards,
Monty
[7 Oct 2003 9:50] Martin Mokrejs
Fixed in bk-1.1603.
[10 Oct 2003 18:09] MySQL Verification Team
Closing according with your own last comment:

Fixed in bk-1.1603.