Bug #29252 Assertion `!table->file || table->file->inited == handler::NONE' failed.
Submitted: 20 Jun 2007 21:44 Modified: 3 Jul 2007 18:51
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: CSV Severity:S1 (Critical)
Version:5.1.20 OS:Any
Assigned to: Alexey Botchkov CPU Architecture:Any
Tags: crash

[20 Jun 2007 21:44] Shane Bester
Description:
doing 20 threads optimize table, checksum table, check table, insert on CSV table causes a crash.

mysqld: sql_base.cc:1267: bool close_thread_table(THD*, TABLE**): Assertion `!table->file || table->file->inited == handler::NONE' failed.
070620 23:23:47 - 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=8388600
read_buffer_size=131072
max_used_connections=4
max_threads=151
threads_connected=4
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 337607 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x8e2ee10
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=0x428f76d4, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x81fbec5 handle_segfault + 805
0xffffe410 _end + -142334016
0x400edb75 _end + 932388645
0x400e5903 _end + 932355251
0x824a9ec _Z18close_thread_tableP3THDPP8st_table + 332
0x824c9a2 _Z19close_thread_tablesP3THDbb + 466
0x832b2aa _Z20mysql_checksum_tableP3THDP13st_table_listP15st_ha_check_opt + 906
0x820edcd _Z21mysql_execute_commandP3THD + 6445
0x82166f2 _Z11mysql_parseP3THDPKcjPS2_ + 418
0x821795a _Z16dispatch_command19enum_server_commandP3THDPcj + 4378
0x82184b5 _Z10do_commandP3THD + 421
0x8205d4f handle_one_connection + 271
VT1020x4004daa7 _end + 931733079
0x4017ec2e _end + 932982750
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html
and follow instructions on how to resolve the stack trace.
Resolved stack trace is much more helpful in diagnosing the
problem, so please do resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8e407b0 = checksum table t1 extended
thd->thread_id=6

How to repeat:
see uploaded testcase

Suggested fix:
.
[20 Jun 2007 21:46] MySQL Verification Team
see top of file for user, host, password, gcc compile example.

Attachment: bug29252.c (text/plain), 6.05 KiB.

[25 Jun 2007 9:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/29486

ChangeSet@1.2528, 2007-06-25 13:31:34+05:00, holyfoot@mysql.com +1 -0
  Bug #29252 Assertion 'table->file || table->file->inited == handler::NONE' failed
  
  when index_init() or rnd_init() return an error, we still set
  handler->inited to INDEX or RND in ha_index_init and ha_rnd_init.
  As caller doesn't call ha_*_end() in this case, we get DBUG_ASSERT
  failed.
[25 Jun 2007 10:09] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/29488

ChangeSet@1.2528, 2007-06-25 13:04:24+05:00, holyfoot@mysql.com +1 -0
  Bug #29252 Assertion 'table->file || table->file->inited == handler::NONE' failed
  
  when index_init() or rnd_init() return an error, we still set
  handler->inited to INDEX or RND in ha_index_init and ha_rnd_init.
  As caller doesn't call ha_*_end() in this case, we get DBUG_ASSERT
  failed.
[25 Jun 2007 10:09] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/29491

ChangeSet@1.2528, 2007-06-25 12:45:34+05:00, holyfoot@mysql.com +1 -0
  Bug #29252 Assertion 'table->file || table->file->inited == handler::NONE' failed
  
  when index_init() or rnd_init() return an error, we still set
  handler->inited to INDEX or RND in ha_index_init and ha_rnd_init.
  As caller doesn't call ha_*_end() in this case, we get DBUG_ASSERT
  failed.
[1 Jul 2007 19:57] Bugs System
Pushed into 5.1.21-beta
[3 Jul 2007 18:51] Paul DuBois
Noted in 5.1.21 changelog.

Many threads accessing a CSV table simultaneously could cause an
assertion failure.