Bug #41801 Read Only Archive storage engine tables crashes MySQL
Submitted: 31 Dec 2008 1:21 Modified: 7 Jan 2009 20:13
Reporter: Michael Hsu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Storage Engine API Severity:S2 (Serious)
Version:5.0.67, 5.1.30, 6.0.8 OS:Any
Assigned to: CPU Architecture:Any
Tags: archive storage engine, CentOS, crash, read only
Triage: Triaged: D1 (Critical)

[31 Dec 2008 1:21] Michael Hsu
Description:
Using Centos 5.2, MySQL 5.0.67.  MySQL crashes when using a database which contains read-only archive storage engine tables.  Particularly the *.ARM files are the ones that cause the crashes when read only.  Just using the database which contains the read-only ARM file causes the crash.  I could not find documentation anywhere that stated that file needed to be read-write, and as an ARCHIVE storage engine, sometimes you don't want the archive tables to ever change so it would make sense to want to make some archive tables read-only.

When the Crash occurs the following error shows up in the error logs...
Version: '5.0.67-debug-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
mysqld: my_seek.c:58: my_seek: Assertion `fd != -1' failed.
081230 17:13:03 - mysqld got signal 6 ;
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=4026531840
read_buffer_size=67108864
max_used_connections=1
max_connections=500
threads_connected=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 167772160 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0xcbbb160
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...
Cannot determine thread, fp=0x416d0fe0, backtrace may not be correct.
Bogus stack limit or frame pointer, fp=0x416d0fe0, stack_bottom=0x416d0000, thread_stack=262144, 
aborting backtrace.
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0xcbf9c70 = 
thd->thread_id=1
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

Number of processes running now: 0
081230 17:13:03  mysqld restarted

Performing a stack trace results with the following:
0x100000000 _end + -15241832
0x1cf090b0 _end + 470285896
0x1cf47c10 _end + 470542760

How to repeat:
1) Create a database.
mysql> create database foo;
2) Create any table using the ARCHIVE storage engine.
mysql> CREATE TABLE archive_table (column_id int) ENGINE=ARCHIVE;
3) Exit mysql and make the .ARM file read-only in your desired way.
  ie: chmod 444 archive_table.ARM
      chattr +i archive_table.ARM

4) attempt to use the database which contains the ARCHIVE tables
mysql> use foo;

5) MySQL crashes...

Suggested fix:
N/A
[31 Dec 2008 3:02] Miguel Solorzano
miguel@hegel:~/dbs$ 5.0/libexec/mysqld
081231  0:56:19  InnoDB: Started; log sequence number 0 43655
081231  0:56:19 [Note] 5.0/libexec/mysqld: ready for connections.
Version: '5.0.76-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
mysqld: my_seek.c:58: my_seek: Assertion `fd != -1' failed.
081231  0:59:51 - mysqld got signal 6 ;

I will test 5.1 and 6.0
[5 Jan 2009 6:27] Shane Bester
Version: '5.1.30-community-debug'  socket: ''  port: 3306  MySQL Community Server - Debug (GPL)
Assertion failed: fd >= 0, file .\my_seek.c, line 91
090105  8:26:16 - mysqld got exception 0x80000003 ;

mysqld-debug.exe!_NMSG_WRITE()[crt0msg.c:198]
mysqld-debug.exe!abort()[abort.c:68]
mysqld-debug.exe!_wassert()[assert.c:212]
mysqld-debug.exe!my_tell()[my_seek.c:91]
mysqld-debug.exe!do_flush()[azio.c:609]
mysqld-debug.exe!azflush()[azio.c:634]
mysqld-debug.exe!ha_archive::check()[ha_archive.cc:1557]
mysqld-debug.exe!handler::ha_check()[handler.cc:3022]
mysqld-debug.exe!mysql_admin_table()[sql_table.cc:4378]
mysqld-debug.exe!mysql_check_table()[sql_table.cc:5076]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:2898]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5791]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1202]
mysqld-debug.exe!do_command()[sql_parse.cc:857]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1115]
mysqld-debug.exe!pthread_start()[my_winthread.c:85]
mysqld-debug.exe!_callthreadstart()[thread.c:295]
mysqld-debug.exe!_threadstart()[thread.c:277]
kernel32.dll!BaseThreadStart()
ariables.
 invalid and cause the dump to abort...
0004C8CB78=check table archive_table
[5 Jan 2009 6:30] Shane Bester
Version: '6.0.8-alpha-community-debug'  socket: ''  port: 3306  MySQL Community Server - Debug (GPL)
Assertion failed: fd >= 2048 && fd < (int)my_file_limit, file .\my_winfile.c, line 93
090105  8:28:35 - mysqld got exception 0x80000003 ;

mysqld-debug.exe!_NMSG_WRITE()[crt0msg.c:195]
mysqld-debug.exe!abort()[abort.c:44]
mysqld-debug.exe!_assert()[assert.c:306]
mysqld-debug.exe!my_get_osfhandle()[my_winfile.c:93]
mysqld-debug.exe!my_win_fsync()[my_winfile.c:642]
mysqld-debug.exe!my_sync()[my_sync.c:66]
mysqld-debug.exe!destroy()[azio.c:439]
mysqld-debug.exe!azopen()[azio.c:237]
mysqld-debug.exe!ha_archive::init_archive_writer()[ha_archive.cc:415]
mysqld-debug.exe!ha_archive::write_row()[ha_archive.cc:805]
mysqld-debug.exe!handler::ha_write_row()[handler.cc:5354]
mysqld-debug.exe!write_record()[sql_insert.cc:1610]
mysqld-debug.exe!mysql_insert()[sql_insert.cc:835]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:3006]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5634]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1009]
mysqld-debug.exe!do_command()[sql_parse.cc:689]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1156]
mysqld-debug.exe!pthread_start()[my_winthread.c:86]
mysqld-debug.exe!_threadstart()[thread.c:196]
kernel32.dll!FlsSetValue()
t some variables.
s may be invalid and cause the dump to abort...
t 070B49A8=insert into archive_table values ()