Bug #34656 KILL a query = Assertion failed: m_status == DA_ERROR || m_status == DA_OK
Submitted: 19 Feb 2008 9:15 Modified: 15 Apr 2008 2:19
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.1.23-debug OS:Windows
Assigned to: Sergey Vojtovich CPU Architecture:Any

[19 Feb 2008 9:15] Shane Bester
Description:
killing some queries in the debug version of 5.1.23 leads to an assertion failing:

Assertion failed: m_status == DA_ERROR || m_status == DA_OK, file d:\mysql-5.1.23-rc-winbuild\mysql-community-debug-5.1.23-rc-build\sql\sql_class.h, line 1023

mysqld.exe!_NMSG_WRITE
mysqld.exe!abort
mysqld.exe!_wassert
mysqld.exe!Diagnostics_area::message|
mysqld.exe!get_schema_tables_record
mysqld.exe!get_all_tables
mysqld.exe!get_schema_tables_result
mysqld.exe!JOIN::exec
mysqld.exe!mysql_select
mysqld.exe!handle_select
mysqld.exe!execute_sqlcom_select
mysqld.exe!mysql_execute_command
mysqld.exe!mysql_parse
mysqld.exe!dispatch_command
mysqld.exe!do_command
mysqld.exe!handle_one_connection
mysqld.exe!pthread_start
mysqld.exe!_callthreadstart
mysqld.exe!_threadstart

How to repeat:
select * from information_schema.tables where 1=sleep(100000);
now kill <id> the above connection from another connection.
[19 Feb 2008 9:58] MySQL Verification Team
Thank you for the bug report.

>	mysqld-debug.exe!_NMSG_WRITE(int rterrnum=10)  Line 195	C
 	mysqld-debug.exe!abort()  Line 44 + 0x7	C
 	mysqld-debug.exe!_assert(const char * expr=0x00a9ee48, const char * filename=0x00a58dec, unsigned int lineno=1027)  Line 306	C
 	mysqld-debug.exe!Diagnostics_area::message()  Line 1027 + 0x3a	C++
 	mysqld-debug.exe!get_schema_tables_record(THD * thd=0x0171bbc8, TABLE_LIST * tables=0x01793c38, st_table * table=0x0174f1e0, int res=1, st_mysql_lex_string * db_name=0x038bdab0, st_mysql_lex_string * table_name=0x038bdac0)  Line 3433 + 0xe	C++
 	mysqld-debug.exe!get_all_tables(THD * thd=0x0171bbc8, TABLE_LIST * tables=0x01747f08, Item * cond=0x01748298)  Line 3303 + 0x2c	C++
 	mysqld-debug.exe!get_schema_tables_result(JOIN * join=0x0175cba8, enum_schema_table_state executed_place=PROCESSED_BY_JOIN_EXEC)  Line 5883 + 0x1a	C++
 	mysqld-debug.exe!JOIN::exec()  Line 1729 + 0x3c	C++
 	mysqld-debug.exe!mysql_select(THD * thd=0x0171bbc8, Item * * * rref_pointer_array=0x0171cf6c, TABLE_LIST * tables=0x01747f08, unsigned int wild_num=1, List<Item> & fields={...}, Item * conds=0x01748298, unsigned int og_num=0, st_order * order=0x00000000, st_order * group=0x00000000, Item * having=0x00000000, st_order * proc_param=0x00000000, unsigned __int64 select_options=2684635648, select_result * result=0x017492b0, st_select_lex_unit * unit=0x0171cba0, st_select_lex * select_lex=0x0171ce68)  Line 2375	C++
 	mysqld-debug.exe!handle_select(THD * thd=0x0171bbc8, st_lex * lex=0x0171cb40, select_result * result=0x017492b0, unsigned long setup_tables_done_option=0)  Line 268 + 0x9f	C++
 	mysqld-debug.exe!execute_sqlcom_select(THD * thd=0x0171bbc8, TABLE_LIST * all_tables=0x01747f08)  Line 4749 + 0x13	C++
 	mysqld-debug.exe!mysql_execute_command(THD * thd=0x0171bbc8)  Line 2056 + 0xd	C++
 	mysqld-debug.exe!mysql_parse(THD * thd=0x0171bbc8, const char * inBuf=0x01747d60, unsigned int length=61, const char * * found_semicolon=0x038bfd00)  Line 5622 + 0x9	C++
 	mysqld-debug.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x0171bbc8, char * packet=0x0173fcb1, unsigned int packet_length=61)  Line 1121 + 0x1e	C++
 	mysqld-debug.exe!do_command(THD * thd=0x0171bbc8)  Line 781 + 0x1b	C++
 	mysqld-debug.exe!handle_one_connection(void * arg=0x0171bbc8)  Line 1120 + 0x9	C++
 	mysqld-debug.exe!pthread_start(void * param=0x016fa5b0)  Line 85 + 0x9	C
 	mysqld-debug.exe!_threadstart(void * ptd=0x017383d0)  Line 196 + 0xd	C
 	kernel32.dll!7c80b683()
[20 Feb 2008 19:25] Omer Barnir
triage: assertion viewed as a crash waiting to happen
[20 Feb 2008 20:57] Konstantin Osipov
Triage: This particular assertion is OK, it should not cause any significant trouble in production. I added it 2 months ago.
But good you classified it as sr51
[4 Mar 2008 13:29] 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/43381

ChangeSet@1.2531, 2008-03-04 17:27:03+04:00, svoj@mysql.com +3 -0
  BUG#34656 - KILL a query = Assertion failed: m_status == DA_ERROR ||
              m_status == DA_OK
  
  Reading from information_scema.tables or information_schema.columns
  may cause assertion failure in debug builds. This may happen under
  rare circumstances when information_schema fails to get information
  about a table (e.g. when a connection is killed).
  
  This happens because open_normal_and_derived_tables() can return an
  error without setting an error message in THD. But information_schema
  attempts to get an error message from THD unconditionally.
  
  With this fix information_schema attempts to get an error message
  from THD only in case error message is set in THD.
[7 Mar 2008 14:45] 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/43595

ChangeSet@1.2531, 2008-03-07 18:41:50+04:00, svoj@mysql.com +4 -0
  BUG#34656 - KILL a query = Assertion failed: m_status == DA_ERROR ||
              m_status == DA_OK
  
  Reading from information_scema.tables or information_schema.columns
  may cause assertion failure in debug builds. This may happen under
  rare circumstances when information_schema fails to get information
  about a table (e.g. when a connection is killed).
  
  This happens because open_normal_and_derived_tables() can return an
  error without setting an error message in THD. But information_schema
  attempts to get an error message from THD unconditionally.
  
  With this fix information_schema attempts to get an error message
  from THD only in case error message is set in THD.
[27 Mar 2008 11:18] Bugs System
Pushed into 5.1.24-rc
[27 Mar 2008 17:50] Bugs System
Pushed into 6.0.5-alpha
[2 Apr 2008 20:07] Jon Stephens
Pushed into 5.1.23-ndb-6.3.11.
[15 Apr 2008 2:19] Paul DuBois
Noted in 5.1.24, 6.0.5 changelogs.

For debug builds, reading from INFORMATION_SCHEMA.TABLES or
INFORMATION_SCHEMA.COLUMNS could cause assertion failures. This could
happen under rare circumstances when INFORMATION_SCHEMA fails to get
information about a table (for example, when a connection is killed).
[15 Apr 2008 2:19] Paul DuBois
Noted in 5.1.24, 6.0.5 changelogs.

For debug builds, reading from INFORMATION_SCHEMA.TABLES or
INFORMATION_SCHEMA.COLUMNS could cause assertion failures. This could
happen under rare circumstances when INFORMATION_SCHEMA fails to get
information about a table (for example, when a connection is killed).