Bug #4901 myisamchk --extend-check often crashes when processing multiple tables
Submitted: 4 Aug 2004 23:38 Modified: 11 Aug 2004 11:47
Reporter: Erik Kay Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:4.1.3-beta OS:Linux (Red Hat Linux ES3/Windows)
Assigned to: Sergei Golubchik CPU Architecture:Any

[4 Aug 2004 23:38] Erik Kay
Description:
If I run myisasmchk --extend-check against a list of .MYI files, it will usually crash when it gets to the second table with this backtrace:
#0  0x0807fbc9 in get_hash_link ()
#1  0x0807f010 in find_key_block ()
#2  0x0807e31a in key_cache_read ()
#3  0x08052318 in _mi_fetch_keypage ()
#4  0x08060af3 in chk_key ()
#5  0x08049330 in myisamchk ()
#6  0x0804828b in main ()
(sorry, no symbols handy)

If we run it against one table at a time, it appears to run fine (e.g. for i in *.MYI ; do myisamchk -e $i; done instead of myisamchk -e *.MYI).

With two tables as arguments, if the second table has no keys, it doesn't crash.

How to repeat:
CREATE TABLE `CRASH1` (
  `one` int(11) default NULL,
  `two` int(11) default NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `CRASH1` VALUES (1,2);

CREATE TABLE `CRASH2` (
  `one` int(11) default NULL,
  `two` int(11) default NULL,
  UNIQUE KEY `one` (`one`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `CRASH2` VALUES (3,4);

myisamchk --extend-check CRASH1.MYI CRASH2.MYI

if you reverse the order of the tables, it won't crash.
[4 Aug 2004 23:57] MySQL Verification Team
Happens on Windows XP too. Thank you for the bug report.
[5 Aug 2004 0:02] MySQL Verification Team
Call Satck:

 		
>	myisamchk.exe!_getptd()  Line 250	C
 	myisamchk.exe!_errno()  Line 163 + 0x5	C
 	myisamchk.exe!_db_enter_(const char * _func_=0x00000000, const char * _file_=0x000007ac, unsigned int _line_=1244420, const char * * _sfunc_=0x77f5b2e6, const char * * _sfile_=0x005755a8, unsigned int * _slevel_=0x0044e57c, char * * * _sframep_=0x005755a8)  Line 761 + 0x5	C
 	myisamchk.exe!key_cache_read(st_key_cache * keycache=0x00575540, int file=3, unsigned __int64 filepos=1024, int level=3, unsigned char * buff=0x00580280, unsigned int length=1024, unsigned int block_length=1024, int return_buffer=0)  Line 1680 + 0x24	C
 	myisamchk.exe!_mi_fetch_keypage(st_myisam_info * info=0x00580080, st_mi_keydef * keyinfo=0x00345930, unsigned __int64 page=1024, int level=3, unsigned char * buff=0x00580280, int return_buffer=0)  Line 36 + 0x41	C
 	myisamchk.exe!chk_key(st_mi_check_param * param=0x00573cc0, st_myisam_info * info=0x00580080)  Line 401 + 0x2a	C
 	myisamchk.exe!myisamchk(st_mi_check_param * param=0x00573cc0, char * filename=0x00342c2c)  Line 1041 + 0xd	C
 	myisamchk.exe!main(int argc=0, char * * argv=0x0034537c)  Line 106 + 0x1f	C
 	myisamchk.exe!mainCRTStartup()  Line 206 + 0x19	C
 	kernel32.dll!77e714c7() 	
 	ntdll.dll!77f944a8()
[11 Aug 2004 11:47] 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

Additional info:

fixed in 4.1.4