Bug #771 myisamchk crash on crashed MYISAM compressed tables

Submitted: 1 Jul 2003 4:12 Modified: 4 Jul 2003 3:14
Reporter: Martin Mokrejs Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:4.0.13 OS:Linux (linux 2.4.19)
Assigned to: CPU Architecture:Any

[1 Jul 2003 4:12] Martin Mokrejs
Description:
I cannot repair crashed MYISAM table. myisamchk crashes.

Please get the crashed tables from http://pedant.gsf.de/Drosophila_melanogaster.tar.gz

Happens on linux i686, 2.4.19 kernel, SMP+HIGHMEM enabled kernel.

How to repeat:
/data/mysql/Drosophila_melanogaster# /usr/local/mysql/bin/myisamchk -r contig_data.MYI
- recovering (with sort) MyISAM-table 'contig_data.MYI'
Data records: 19
- Fixing index 1
Segmentation fault
/data/mysql/Drosophila_melanogaster# 

strace  shows:

[...]
getcwd("/data/mysql/Drosophila_melanogaster", 4095) = 36
lstat64("/data/mysql/Drosophila_melanogaster/contig_data.MYD", {st_mode=S_IFREG|0660, st_size=32199438, ...}) = 0
open("/data/mysql/Drosophila_melanogaster/contig_data.TMD", O_RDWR|O_CREAT|O_TRUNC|O_EXCL|O_LARGEFILE, 0664) = 5
_llseek(4, 0, [0], SEEK_SET)            = 0
read(4, "\376\376\10\1\253\0\0\0\256\263\1\0\10>g\0<\0\0\0\0\0\0"..., 171) = 171
write(5, "\376\376\10\1\253\0\0\0\256\263\1\0\10>g\0<\0\0\0\0\0\0"..., 171) = 171
_llseek(4, 0, [32199438], SEEK_END)     = 0
write(1, "- Fixing index 1\n", 17- Fixing index 1
)      = 17
_llseek(4, 171, [171], SEEK_SET)        = 0
read(4, "\377I{-\377;.\241\276%\tW2VH\240\30\356\7\244P\fv\263\321"..., 8388437) = 8388437
mremap(0x40000000, 6766592, 13545472, MREMAP_MAYMOVE) = 0x4235f000
mremap(0x4235f000, 13545472, 19308544, MREMAP_MAYMOVE) = 0x4235f000
read(4, "\372&F\312\216\316\7\325\331\325\357\272\'\0309\231\357"..., 4014080) = 4014080
read(4, "\23\333\374yC7\305\276\376\231>\231p\334f\366\3469\204"..., 8388608) = 8388608
_llseek(5, 171, [171], SEEK_SET)        = 0
write(5, "\377I{-\377;.\241\276%\tW2VH\240\30\356\7\244P\fv\263\321"..., 8388437) = 8388437
write(5, "\372&F\312\216\316\7\325\331\325\357\272\'\0309\231\357"..., 4014080) = 4014080
mremap(0x4235f000, 19308544, 20926464, MREMAP_MAYMOVE) = 0x4235f000
read(4, "~{g\367\23a\373\257g\260\377*l\342\vuF\351\223\242:\210"..., 6533120) = 6533120
read(4, "\302\213e_7A{q\17\35\35\217\315\343y6\313|<\246\370\247"..., 4875022) = 4875022
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
getcwd("/data/mysql/Drosophila_melanogaster", 4095) = 36
lstat64("/data/mysql/Drosophila_melanogaster/contig_data.MYD", {st_mode=S_IFREG|0660, st_size=32199438, ...}) = 0
open("/data/mysql/Drosophila_melanogaster/contig_data.TMD", O_RDWR|O_CREAT|O_TRUNC|O_EXCL|O_LARGEFILE, 0664) = 5
_llseek(4, 0, [0], SEEK_SET)            = 0
read(4, "\376\376\10\1\253\0\0\0\256\263\1\0\10>g\0<\0\0\0\0\0\0"..., 171) = 171
write(5, "\376\376\10\1\253\0\0\0\256\263\1\0\10>g\0<\0\0\0\0\0\0"..., 171) = 171
_llseek(4, 0, [32199438], SEEK_END)     = 0
write(1, "- Fixing index 1\n", 17- Fixing index 1
)      = 17
_llseek(4, 171, [171], SEEK_SET)        = 0
read(4, "\377I{-\377;.\241\276%\tW2VH\240\30\356\7\244P\fv\263\321"..., 8388437) = 8388437
mremap(0x40000000, 6766592, 13545472, MREMAP_MAYMOVE) = 0x4235f000
mremap(0x4235f000, 13545472, 19308544, MREMAP_MAYMOVE) = 0x4235f000
read(4, "\372&F\312\216\316\7\325\331\325\357\272\'\0309\231\357"..., 4014080) = 4014080
read(4, "\23\333\374yC7\305\276\376\231>\231p\334f\366\3469\204"..., 8388608) = 8388608
_llseek(5, 171, [171], SEEK_SET)        = 0
write(5, "\377I{-\377;.\241\276%\tW2VH\240\30\356\7\244P\fv\263\321"..., 8388437) = 8388437
write(5, "\372&F\312\216\316\7\325\331\325\357\272\'\0309\231\357"..., 4014080) = 4014080
mremap(0x4235f000, 19308544, 20926464, MREMAP_MAYMOVE) = 0x4235f000
read(4, "~{g\367\23a\373\257g\260\377*l\342\vuF\351\223\242:\210"..., 6533120) = 6533120
read(4, "\302\213e_7A{q\17\35\35\217\315\343y6\313|<\246\370\247"..., 4875022) = 4875022
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
#
[2 Jul 2003 5:43] Martin Mokrejs
It demonstrates one more bug:

mysql> repair table contig_data;

[I pressed after a while ctrl+c, as the .TMD file has zero size all the time. I guess because of the crash demonstratable easily by myisamchk -r reportted here originally)]

Aborted
bioadmin@bontebok$ mysqladmin -hjerboas processlist
+----+--------+----------------------+-------------------------+---------+------+-------------------+---------------
-----------+
| Id | User   | Host                 | db                      | Command | Time | State             | Info          
           |
+----+--------+----------------------+-------------------------+---------+------+-------------------+---------------
-----------+
| 45 | pedant | bontebok.gsf.de:3833 | Drosophila_melanogaster | Query   | 73   | Repair by sorting | repair table c
ontig_data |
| 50 | pedant | bontebok.gsf.de:3844 |                         | Query   | 0    |                   | show processli
st         |
+----+--------+----------------------+-------------------------+---------+------+-------------------+---------------
-----------+
bioadmin@bontebok$ mysql -hjerboas Drosophila_melanogaster
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

kill 45;

bioadmin@bontebok$ mysql -hjerboas 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 52 to server version: 4.0.13-standard-log

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

mysql> show processlist;        
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
| Id | User   | Host                 | db                      | Command    | Time | State             | Info                     |
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
| 45 | pedant | bontebok.gsf.de:3833 | Drosophila_melanogaster | Query      | 110  | Repair by sorting | repair table contig_data |
| 51 | pedant | bontebok.gsf.de:3849 | Drosophila_melanogaster | Field List | 32   | Waiting for table |                          |
| 52 | pedant | bontebok.gsf.de:3850 | NULL                    | Query      | 0    | NULL              | show processlist         |
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
3 rows in set (0.00 sec)

mysql> kill 45;
Query OK, 0 rows affected (0.00 sec)

mysql> show processlist;        
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
| Id | User   | Host                 | db                      | Command    | Time | State             | Info                     |
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
| 45 | pedant | bontebok.gsf.de:3833 | Drosophila_melanogaster | Killed     | 119  | Repair by sorting | repair table contig_data |
| 51 | pedant | bontebok.gsf.de:3849 | Drosophila_melanogaster | Field List | 41   | Waiting for table |                          |
| 52 | pedant | bontebok.gsf.de:3850 | NULL                    | Query      | 0    | NULL              | show processlist         |
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
3 rows in set (0.00 sec)

mysql> show processlist;
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
| Id | User   | Host                 | db                      | Command    | Time | State             | Info                     |
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
| 45 | pedant | bontebok.gsf.de:3833 | Drosophila_melanogaster | Killed     | 122  | Repair by sorting | repair table contig_data |
| 51 | pedant | bontebok.gsf.de:3849 | Drosophila_melanogaster | Field List | 44   | Waiting for table |                          |
| 52 | pedant | bontebok.gsf.de:3850 | NULL                    | Query      | 0    | NULL              | show processlist         |
+----+--------+----------------------+-------------------------+------------+------+-------------------+--------------------------+
3 rows in set (0.00 sec)

So the killed process doesn't go away!
[3 Jul 2003 17:15] Michael Widenius
To be able to repeat the problem we would need a copy of the packed table (and if possible a copy of the not packed data).

You can upload any testcase to ftp://support.mysql.com/pub/mysql/secret
[4 Jul 2003 3:14] Sergei Golubchik
I wasn't able to repeat it.

myisamchk produces tons of messages like

Found link that points at -8769496673510283653 (outside data file) at 1259552
Found link that points at 2865652877524523398 (outside data file) at 1260016
Found block with too small length at 1260840; Skipped
Found link that points at -7233973963831846416 (outside data file) at 1260896
Found link that points at 323910004596437184 (outside data file) at 1260916
Found link that points at -2580456083037413577 (outside data file) at 1261388
Found block with too small length at 1261604; Skipped
Found block with too small length at 1263060; Skipped
Found block with too small length at 1263448; Skipped
Found link that points at -1091879638804344063 (outside data file) at 1263596

but does not crash
[15 Jul 2003 5:56] Martin Mokrejs
Hmm, I can't repeat the crash even myself now, strange. mysql version is definitely same. :(

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.