Bug #38797 Assertion (inited==RND) failed in handler::ha_rnd_end
Submitted: 14 Aug 2008 13:30 Modified: 21 Aug 2008 18:57
Reporter: Philip Stoev Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1-bzr OS:Any (Linux)
Assigned to: Assigned Account CPU Architecture:Any
Triage: D1 (Critical)

[14 Aug 2008 13:30] Philip Stoev
Description:
When executing a workload containing insert/update/delete/select against partitioned tables, mysqld asserted as follows:

#8  0x003df57e in __assert_fail () from /lib/libc.so.6
#9  0x0817478e in handler::ha_rnd_end (this=0x9d9dd38) at handler.h:1183
#10 0x0836f673 in ha_partition::rnd_end (this=0x9d9db50) at ha_partition.cc:3195
#11 0x081747d0 in handler::ha_rnd_end (this=0x9d9db50) at handler.h:1185
#12 0x0817480f in handler::ha_index_or_rnd_end (this=0x9d9db50) at handler.h:1191
#13 0x0835f5bf in end_read_record (info=0xb2961240) at records.cc:269
#14 0x082f887d in mysql_delete (thd=0x9e3cfc0, table_list=0x9e77958, conds=0x9e77c38, order=0x9e3e408, limit=1, options=0, reset_auto_increment=false)
    at sql_delete.cc:337
#15 0x08259d53 in mysql_execute_command (thd=0x9e3cfc0) at sql_parse.cc:3083
#16 0x0825f95c in mysql_parse (thd=0x9e3cfc0,
    inBuf=0x9e77007 "DELETE FROM table1_innodb_key_pk_parts_2_int_autoinc WHERE int_key < 1 LIMIT 1 ; SET BINLOG_FORMAT = @binlog_format_saved", length=121,
    found_semicolon=0xb296225c) at sql_parse.cc:5650
#17 0x08260661 in dispatch_command (command=COM_QUERY, thd=0x9e3cfc0, packet=0x9e3e949 "", packet_length=192) at sql_parse.cc:1173
#18 0x08261692 in do_command (thd=0x9e3cfc0) at sql_parse.cc:794
#19 0x0824ede6 in handle_one_connection (arg=0x9e3cfc0) at sql_connect.cc:1115
#20 0x0057d32f in start_thread () from /lib/libpthread.so.0
#21 0x0049a27e in clone () from /lib/libc.so.6

The assert is here:

1178        DBUG_RETURN(result);
1179      }
1180      int ha_rnd_end()
1181      {
1182        DBUG_ENTER("ha_rnd_end");
1183        DBUG_ASSERT(inited==RND); <<<<<< HERE
1184        inited=NONE;
1185        DBUG_RETURN(rnd_end());
1186      }
1187      int ha_reset();

(gdb) print inited
$1 = handler::NONE

How to repeat:
This is a repeatable bug, a test case will be provided shortly.
[14 Aug 2008 15:50] Philip Stoev
Grammar file for bug 38797

Attachment: bug38797.yy (application/octet-stream, text), 384 bytes.

[14 Aug 2008 15:50] Philip Stoev
Data Generator file for bug 38797

Attachment: bug38797.zz (text/plain), 537 bytes.

[14 Aug 2008 15:54] Philip Stoev
To reproduce this bug, please clone the mysql-test-extra-6.0 tree and execute the following:

$ cd mysql-test-extra-6.0/mysql-test/gentest
$ perl runall.pl \
  --basedir=/path/to/mysql-5.1/ \
  --gendata=/location/of/bug38797.zz \
  --grammar=/location/of/bug38797.yy \
  --mysqld=--log-output=file \ # This is required to prevent a system-wide deadlock
  --threads=10 \
  --mysqld=--innodb_lock_wait_timeout=1 # This is required to cause the crash faster.

This will create both partitioned and unpartitioned MyISAM and Innodb tables, and will then proceed to run very simple transactions against them. Deadlocks will happen and once an offending deadlock times out, the server will crash.

See also bug # 34604.
[15 Aug 2008 8:24] Sveta Smirnova
Thank you for the report.

Verified as described.
[20 Aug 2008 19:45] Mattias Jonsson
Most probably a duplicate of bug#34604 (I managed to crash on the assert before the patch, but not after). That patch is now pushed into mysql-5.1-bugteam.

Philip, could you please verify this and if duplicate, change status accordingly?
[21 Aug 2008 18:57] Philip Stoev
This test case no longer fails on 5.1-bugteam. As requested, I am marking this as a duplicate to bug#34604 .