Bug #55986 | Assertion `inited==INDEX' in handler::ha_index_end() on INSERT..SELECT..(SELECT) | ||
---|---|---|---|
Submitted: | 15 Aug 2010 2:51 | Modified: | 6 Jun 2011 7:12 |
Reporter: | Elena Stepanova | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
Version: | 5.6.99-m5-debug, 5.6.2-debug | OS: | Any |
Assigned to: | Roy Lyseng | CPU Architecture: | Any |
Tags: | regression |
[15 Aug 2010 2:51]
Elena Stepanova
[4 Oct 2010 7:37]
Roy Lyseng
The code that causes the regression was backported from the former 6.0 development branch at 2010-02-27. The backported code comes from WL#1110 - Subquery optimization: Materialization. This is a genuine regression - there is no need to toggle any optimizer switch settings to provoke the error.
[31 Jan 2011 6:36]
MySQL Verification Team
i appear to run into this bug alot on mysql-trunk when explaining selects with many views and joins and subqueries. no testcase yet, but i've seen it in a single threaded test. mysqld: ./sql/handler.h:1551: int handler::ha_index_end(): Assertion `inited==INDEX' failed. 110130 13:59:03 - mysqld got signal 6 ; (gdb) bt #0 __pthread_kill at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63 #1 in my_write_core at ./mysys/stacktrace.c:423 #2 in handle_segfault at ./sql/mysqld.cc:2512 #3 <signal handler called> #4 in ?? () #5 in handler::ha_index_end at ./sql/handler.h:1554 #6 in subselect_uniquesubquery_engine::cleanup at ./sql/item_subselect.cc:2138 #7 in Item_subselect::cleanup at ./sql/item_subselect.cc:123 #8 in Item_in_subselect::cleanup at ./sql/item_subselect.cc:155 #9 in Item::delete_self at ./sql/item.h:1171 #10 in Query_arena::free_items at ./sql/sql_class.cc:2674 #11 in THD::cleanup_after_query at ./sql/sql_class.cc:1452 #12 in mysql_parse at ./sql/sql_parse.cc:5565 #13 in dispatch_command at ./sql/sql_parse.cc:1078 #14 in do_command at ./sql/sql_parse.cc:815 #15 in do_handle_one_connection at ./sql/sql_connect.cc:748 #16 in handle_one_connection at ./sql/sql_connect.cc:684 #17 in start_thread at pthread_create.c:301 #18 in clone at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115 (gdb) The explain for these particular queries all have index_subquery join types: +--------------------+-------+----------------+- | select_type | table | type | +--------------------+-------+----------------+- | PRIMARY | t1_0 | ALL | | PRIMARY | t69_4 | index | | PRIMARY | t48_1 | index | | PRIMARY | t50_3 | ALL | | DEPENDENT SUBQUERY | t95_2 | index_subquery | +--------------------+-------+----------------+-
[31 Jan 2011 13:41]
MySQL Verification Team
Roy, you might be right. I repeated this bug in a single thread alot easier after I ran set global table_open_cache=1. In valgrind it looks like this: Version: '5.6.2-m5-valgrind-max-debug' socket: 'sock' port: 3306 Source distribution Thread 18: Invalid read of size 8 at: subselect_uniquesubquery_engine::cleanup() (item_subselect.cc:2137) by: Item_subselect::cleanup() (item_subselect.cc:123) by: Item_in_subselect::cleanup() (item_subselect.cc:155) by: Item::delete_self() (item.h:1171) by: Query_arena::free_items() (sql_class.cc:2674) by: THD::cleanup_after_query() (sql_class.cc:1452) by: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5565) by: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1078) by: do_command(THD*) (sql_parse.cc:815) by: do_handle_one_connection(THD*) (sql_connect.cc:748) by: handle_one_connection (sql_connect.cc:684) by: start_thread (pthread_create.c:301) Address 0x15b1ea68 is 8 bytes inside a block of size 2,240 free'd at: free (vg_replace_malloc.c:325) by: my_free (my_malloc.c:128) by: free_cache_entry(TABLE*) (sql_base.cc:880) by: close_thread_table(THD*, TABLE**) (sql_base.cc:1562) by: close_open_tables(THD*) (sql_base.cc:1299) by: close_thread_tables(THD*) (sql_base.cc:1506) by: mysql_execute_command(THD*) (sql_parse.cc:4419) by: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5550) by: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1078) by: do_command(THD*) (sql_parse.cc:815) by: do_handle_one_connection(THD*) (sql_connect.cc:748) by: handle_one_connection (sql_connect.cc:684) by: start_thread (pthread_create.c:301) 0x00000000007eee87 in subselect_uniquesubquery_engine::cleanup (this=0x1a30f4e0) at /home/sbester/build/bzr/mysql-trunk/sql/item_subselect.cc:2137 2137 if (tab->table->file->inited) (gdb) list 2132 2133 void subselect_uniquesubquery_engine::cleanup() 2134 { 2135 DBUG_ENTER("subselect_uniquesubquery_engine::cleanup"); 2136 /* Tell handler we don't need the index anymore */ 2137 if (tab->table->file->inited) 2138 tab->table->file->ha_index_end(); 2139 DBUG_VOID_RETURN; 2140 } 2141 (gdb) p tab->table->file->inited Cannot access memory at address 0x188 (gdb) p tab->table->file $1 = (handler *) 0x0 (gdb) p tab->table $2 = (TABLE *) 0x15b1ea60
[1 Mar 2011 16:40]
Roy Lyseng
I just pushed a bug fix for bug#56080 (aka 11763382) into mysql-next-mr-backporting branch. Please investigate whether the fix also solves this problem.
[1 Apr 2011 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[2 May 2011 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[3 Jun 2011 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".