Bug #69641 | Crash when enabling innodb_table_monitor (assertion: ib_table->stat_initialized) | ||
---|---|---|---|
Submitted: | 1 Jul 2013 21:48 | Modified: | 31 Mar 2014 16:33 |
Reporter: | Daniël van Eeden (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S1 (Critical) |
Version: | 5.6.12 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | crash |
[1 Jul 2013 21:48]
Daniël van Eeden
[1 Jul 2013 22:03]
Daniël van Eeden
It might be nessesary to run analyze table on all tables first (mysqlcheck -A -a)
[1 Jul 2013 22:17]
MySQL Verification Team
I was able to repeat it after a few tries! InnoDB: Assertion failure in thread 12156 in file ha_innodb.cc line 10802 InnoDB: Failing assertion: ib_table->stat_initialized InnoDB: We intentionally generate a memory trap. mysqld-debug.exe!my_sigabrt_handler()[my_thr_init.c:499] mysqld-debug.exe!raise()[winsig.c:586] mysqld-debug.exe!abort()[abort.c:74] mysqld-debug.exe!ha_innobase::info_low()[ha_innodb.cc:10802] mysqld-debug.exe!ha_innobase::info()[ha_innodb.cc:11095] mysqld-debug.exe!TABLE_LIST::fetch_number_of_rows()[table.cc:6005] mysqld-debug.exe!make_join_statistics()[sql_optimizer.cc:3169] mysqld-debug.exe!JOIN::optimize()[sql_optimizer.cc:381] mysqld-debug.exe!mysql_execute_select()[sql_select.cc:1086] mysqld-debug.exe!mysql_select()[sql_select.cc:1221] mysqld-debug.exe!handle_select()[sql_select.cc:110] mysqld-debug.exe!execute_sqlcom_select()[sql_parse.cc:5046] mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:2604] mysqld-debug.exe!mysql_parse()[sql_parse.cc:6187] mysqld-debug.exe!dispatch_command()[sql_parse.cc:1334] mysqld-debug.exe!do_command()[sql_parse.cc:1036] mysqld-debug.exe!do_handle_one_connection()[sql_connect.cc:977] mysqld-debug.exe!handle_one_connection()[sql_connect.cc:893] mysqld-debug.exe!pfs_spawn_thread()[pfs.cc:1855] mysqld-debug.exe!pthread_start()[my_winthread.c:61] mysqld-debug.exe!_callthreadstartex()[threadex.c:314] mysqld-debug.exe!_threadstartex()[threadex.c:297]
[1 Jul 2013 22:44]
MySQL Verification Team
If you enable the innodb_table_monitor during a random ddl test, it also crashes after a while... mysqld.exe!my_sigabrt_handler()[my_thr_init.c:498] mysqld.exe!raise()[winsig.c:586] mysqld.exe!abort()[abort.c:74] mysqld.exe!ha_innobase::info_low()[ha_innodb.cc:10812] mysqld.exe!ha_innobase::info()[ha_innodb.cc:11095] mysqld.exe!copy_data_between_tables()[sql_table.cc:8610] mysqld.exe!mysql_alter_table()[sql_table.cc:8252] mysqld.exe!Sql_cmd_alter_table::execute()[sql_alter.cc:313] mysqld.exe!mysql_execute_command()[sql_parse.cc:4898] mysqld.exe!mysql_parse()[sql_parse.cc:6187] mysqld.exe!dispatch_command()[sql_parse.cc:1337] mysqld.exe!do_command()[sql_parse.cc:1036] mysqld.exe!do_handle_one_connection()[sql_connect.cc:977] mysqld.exe!handle_one_connection()[sql_connect.cc:893] mysqld.exe!pfs_spawn_thread()[pfs.cc:1855] mysqld.exe!pthread_start()[my_winthread.c:61] mysqld.exe!_callthreadstartex()[threadex.c:314] mysqld.exe!_threadstartex()[threadex.c:292]
[19 Nov 2013 12:10]
Daniël van Eeden
Add Crash tag
[17 Dec 2013 16:10]
MySQL Verification Team
Testcase from http://bugs.mysql.com/bug.php?id=71163 --------- drop procedure if exists p1; delimiter $ create procedure p1() begin declare continue handler for sqlexception begin end; repeat if rand()*10000 >9999 then drop table if exists innodb_table_monitor; select 'dropped'; end if; if rand()*100 <20 then create table if not exists innodb_table_monitor(a int)engine=innodb; select 'created'; end if; if rand()>0.5 then drop table if exists t1; end if; if rand()>0.5 then create table if not exists t1(a int primary key)partition by key(a) partitions 5; end if; if rand()>0.1 then replace into t1 values(rand()*100); end if; if rand()>0.1 then select * from information_schema.INNODB_SYS_TABLESTATS where name like '%t1%'; end if; if(rand()>0.1 then analyze table t1; end if; until 1=2 end repeat; end $ delimiter ; call p1(); ----------
[31 Mar 2014 16:33]
Daniel Price
Fixed as of 5.6.18, 5.7.5 and here's the changelog entry: Enabling the "InnoDB" Table Monitor would result in a "ib_table->stat_initialized" assertion failure. Thank you for the bug report.
[2 Jun 2014 13:55]
Laurynas Biveinis
$ bzr log -r 5864 ------------------------------------------------------------ revno: 5864 committer: Aditya A <aditya.a@oracle.com> branch nick: mysql-5.6 timestamp: Tue 2014-03-18 14:59:24 +0530 message: Bug#17039528 CRASH WHEN ENABLING INNODB_TABLE_MONITOR (ASSERTION: IB_TABLE->STAT_INITIALIZED) PROBLEM ------- While saving the statistics to the disk there is an assert to check if statistics have been initialized or not,which was failing. The reason for this failure was that the variable table->stat_initialized was set as FALSE by dict_table_print() which is called by background server monitor thread. void dict_table_print() { if(!table->stat_initialized) { dict_stats_update_transient(table); } /* print the statistics */ table->stat_initialized = FALSE; } If the table statistics are not initialized then dict_table_print() will update the the statistics using dict_stats_update_transient() which sets table->stat_initialized = TRUE,print the statistics and then set table->stat_initialized = FALSE to bring it back to its original state. This is wrong because we are doing it without prior knowledge of state of stat_initialized variable (It might be TRUE from the beginning). Since the the variable table->stat_initialized is not a protected member, it can be set TRUE at any time. FIX --- We do not need to set table->stat_initialized = FALSE. The print function just need to print the statistics and call dict_stats_update_transient() only when table->stat_initialized is FALSE. [Aprooved by Vasil #rb4944]