Bug #54108 assert in TABLE_LIST::hide_view_error
Submitted: 31 May 2010 15:32 Modified: 17 Jan 2011 11:50
Reporter: Matthias Leich Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.6.99-m4-debug,5.5.5-m3 OS:Any
Assigned to: Jon Olav Hauglid CPU Architecture:Any

[31 May 2010 15:32] Matthias Leich
Description:
The assert happens in sql/table.cc line 3427:
  if (thd->killed || thd->get_internal_handler())
    return;
  /* Hide "Unknown column" or "Unknown function" error */
  DBUG_ASSERT(thd->is_error());  <------------

RQG test with
- 64 threads
- derivate of the WL5005_* grammars

Result on 5.6.99-m4-debug
mysql-next-mr revno: 3153 2010-05-31
------------------------------------
#0  0x00007f9196a3dce6 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000009fb6a1 in my_write_core (sig=6)
                       at .../mysys/stacktrace.c:326
#2  0x000000000053cbf6 in handle_segfault (sig=6)
                       at .../sql/mysqld.cc:2787
#3  <signal handler called>
#4  0x00007f9195c555c5 in raise () from /lib64/libc.so.6
#5  0x00007f9195c56bb3 in abort () from /lib64/libc.so.6
#6  0x00007f9195c4e1e9 in __assert_fail () from /lib64/libc.so.6
#7  0x000000000066ec4f in TABLE_LIST::hide_view_error (this=0x381dbc0, thd=0x7f91885f7ff8)
                       at .../sql/table.cc:3427
#8  0x000000000073afe5 in view_error_processor (thd=0x7f91885f7ff8, data=0x381dbc0)
                       at .../sql/item.cc:8238
#9  0x000000000074c3be in Name_resolution_context::process_error (this=0x1fb1528, thd=0x7f91885f7ff8)
                       at .../sql/item.h:351
#10 0x00000000007459fa in Item_field::fix_fields (this=0x1fb2188, thd=0x7f91885f7ff8, reference=0x2a56878)
                       at .../sql/item.cc:4747
#11 0x000000000066e44b in create_view_field (thd=0x7f91885f7ff8, view=0x381dbc0, field_ref=0x2a56878, name=0x1fb22a0 "col_int")
                       at .../sql/table.cc:4071
#12 0x000000000066e55e in Field_iterator_view::create_item (this=0x478383c0, thd=0x7f91885f7ff8)
                       at .../sql/table.cc:4046
#13 0x000000000057d0b7 in find_field_in_view (thd=0x7f91885f7ff8, table_list=0x381dbc0, name=0x381e200 "col_int", length=7, item_name=0x381e200 "col_int", ref=0x381e308, register_tree_change=true)
                       at .../sql/sql_base.cc:5764
#14 0x000000000057df25 in find_field_in_table_ref (thd=0x7f91885f7ff8, table_list=0x381dbc0, name=0x381e200 "col_int", length=7, item_name=0x381e200 "col_int", db_name=0x0, table_name=0x0, ref=0x381e308, check_privileges=true,
    allow_rowid=true, cached_field_index_ptr=0x381e2c4, register_tree_change=true, actual_table=0x47838898)
                       at .../sql/sql_base.cc:6103
#15 0x000000000057e726 in find_field_in_tables (thd=0x7f91885f7ff8, item=0x381e218, first_table=0x381dbc0, last_table=0x0, ref=0x381e308, report_error=IGNORE_EXCEPT_NON_UNIQUE, check_privileges=true, register_tree_change=true)
                       at .../sql/sql_base.cc:6375
#16 0x0000000000745157 in Item_field::fix_fields (this=0x381e218, thd=0x7f91885f7ff8, reference=0x381e308)
                       at .../sql/item.cc:4540
#17 0x000000000057af22 in setup_fields (thd=0x7f91885f7ff8, ref_pointer_array=0x0, fields=@0x7f91885fa460, mark_used_columns=MARK_COLUMNS_WRITE, sum_func_list=0x0, allow_sum_func=false)
                       at .../sql/sql_base.cc:7546
#18 0x00000000005b8351 in check_insert_fields (thd=0x7f91885f7ff8, table_list=0x381dbc0, fields=@0x7f91885fa460, values=@0x7f91885f9f10, check_unique=false, fields_and_values_from_different_maps=true, map=0x47838cc8)
                       at .../sql/sql_insert.cc:257
#19 0x00000000005b86a9 in select_insert::prepare (this=0x2a56898, values=@0x7f91885f9f10, u=0x7f91885f9990)
                       at .../sql/sql_insert.cc:3063
#20 0x000000000061ab5a in JOIN::prepare (this=0x7f9188029a10, rref_pointer_array=0x1d99768, tables_init=0x7f91885f99e0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, group_init=0x0, having_init=0x0, proc_param_init=0x0,
    select_lex_arg=0x1d99598, unit_arg=0x7f91885f9990)
                       at .../sql/sql_select.cc:704
#21 0x000000000061ae44 in mysql_select (thd=0x7f91885f7ff8, rref_pointer_array=0x1d99768, tables=0x7f91885f99e0, wild_num=0, fields=@0x7f91885f9f10, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0,
    select_options=268435456, result=0x2a56898, unit=0x7f91885f9990, select_lex=0x1d99598)
                       at .../sql/sql_select.cc:2508
#22 0x000000000065d311 in st_select_lex_unit::exec (this=0x7f91885f9990)
                       at .../sql/sql_union.cc:607
#23 0x000000000065e784 in mysql_union (thd=0x7f91885f7ff8, lex=0x7f91885f98f0, result=0x2a56898, unit=0x7f91885f9990, setup_tables_done_option=1073741824)
                       at .../sql/sql_union.cc:38
#24 0x00000000006203f8 in handle_select (thd=0x7f91885f7ff8, lex=0x7f91885f98f0, result=0x2a56898, setup_tables_done_option=1073741824)
                       at .../sql/sql_select.cc:266
#25 0x00000000005cebbb in mysql_execute_command (thd=0x7f91885f7ff8)
                       at .../sql/sql_parse.cc:3249
#26 0x00000000005d385e in mysql_parse (thd=0x7f91885f7ff8,
    inBuf=0x381d888 "INSERT  IGNORE INTO testdb_S . t1_view1_S  ( `col_int_key` , `col_int` , `pk`  ) SELECT  SQL_NO_CACHE `col_int` , `pk` , `col_int_key`  FROM ( SELECT * FROM testdb_N . t1_temp2_N  ) AS A UNION SELECT "...,
    length=311, parser_state=0x4783a9b0)
                       at .../sql/sql_parse.cc:5816
#27 0x00000000005d445d in dispatch_command (command=COM_QUERY, thd=0x7f91885f7ff8,
    packet=0x7f91881d9619 "INSERT  IGNORE INTO testdb_S . t1_view1_S  ( `col_int_key` , `col_int` , `pk`  ) SELECT  SQL_NO_CACHE `col_int` , `pk` , `col_int_key`  FROM ( SELECT * FROM testdb_N . t1_temp2_N  ) AS A UNION SELECT "...
, packet_length=311)
                       at .../sql/sql_parse.cc:1085
#28 0x00000000005d5985 in do_command (thd=0x7f91885f7ff8)
                       at .../sql/sql_parse.cc:771
#29 0x00000000006a0df0 in do_handle_one_connection (thd_arg=0x7f91885f7ff8)
                       at .../sql/sql_connect.cc:1195
#30 0x00000000006a0eb5 in handle_one_connection (arg=0x7f91885f7ff8)
                       at .../sql/sql_connect.cc:1134
#31 0x00007f9196a39040 in start_thread () from /lib64/libpthread.so.0
#32 0x00007f9195cf608d in clone () from /lib64/libc.so.6
#33 0x0000000000000000 in ?? ()
Waiting for mysqld with pid 30978 to terminate...

This bug looks a lot like
   Bug#47736 killing a select from a view when
             the view is processing a function, asserts
but the fix for Bug#47736 is already within my tree.

How to repeat:
I will try to come up with simplified grammars soon.
[23 Jun 2010 11:51] Matthias Leich
Result on mysql-trunk-runtime last pull 2010-06-15
--------------------------------------------------
Thread 1 (Thread 29562):
#0  0x000000382860bd02 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000b595bd in my_write_core (sig=6) at stacktrace.c:326
#2  0x00000000006993a3 in handle_segfault (sig=6) at mysqld.cc:2791
#3  <signal handler called>
#4  0x0000003827a30265 in raise () from /lib64/libc.so.6
#5  0x0000003827a31d10 in abort () from /lib64/libc.so.6
#6  0x0000003827a296e6 in __assert_fail () from /lib64/libc.so.6
#7  0x00000000007109f1 in TABLE_LIST::hide_view_error (this=0x1d3c62e0,
    thd=0x2aaab416b848) at table.cc:3430
#8  0x00000000005b8473 in view_error_processor (thd=0x2aaab416b848,
    data=0x1d3c62e0) at item.cc:8238
#9  0x00000000005ca1fa in Name_resolution_context::process_error (
    this=0x2aaab42e18c0, thd=0x2aaab416b848) at item.h:360
#10 0x00000000005e6704 in Item_func_sp::execute (this=0x2aaab42e2c98)
    at item_func.cc:6219
#11 0x00000000005fa7af in Item_func_sp::val_int (this=0x2aaab42e2c98)
    at item_func.h:1723
#12 0x00000000005fbdec in Arg_comparator::compare_int_signed (
    this=0x2aaab42e2ef8) at item_cmpfunc.cc:1463
#13 0x00000000005de15f in Arg_comparator::compare (this=0x2aaab42e2ef8)
    at item_cmpfunc.h:87
#14 0x000000000060045d in Item_func_eq::val_int (this=0x2aaab42e2e48)
    at item_cmpfunc.cc:1870
#15 0x00000000005b7c2e in Item::val_bool (this=0x2aaab42e2e48) at item.cc:199
#16 0x00000000005ff069 in Item_cond_and::val_int (this=0x2aaab42a8e20)
    at item_cmpfunc.cc:4400
#17 0x0000000000731da3 in make_join_select (join=0x2aaab4261858,
    select=0x2aaab4262fb8, cond=0x2aaab42a7f80) at sql_select.cc:6341
#18 0x0000000000740e9a in JOIN::optimize (this=0x2aaab4261858)
    at sql_select.cc:1165
#19 0x0000000000744853 in mysql_select (thd=0x2aaab416b848,
    rref_pointer_array=0x2aaab416d9b0, tables=0x1d3c62e0, wild_num=0,
    fields=..., conds=0x1d3c6cf8, og_num=0, order=0x0, group=0x0, having=0x0,
    proc_param=0x0, select_options=3489925888, result=0x2aaab42b2a10,
    unit=0x2aaab416d1e0, select_lex=0x2aaab416d7e0) at sql_select.cc:2535
#20 0x000000000074a036 in handle_select (thd=0x2aaab416b848,
    lex=0x2aaab416d138, result=0x2aaab42b2a10,
    setup_tables_done_option=1073741824) at sql_select.cc:290
#21 0x00000000006adc6b in mysql_execute_command (thd=0x2aaab416b848)
    at sql_parse.cc:3283
#22 0x00000000006b2995 in mysql_parse (thd=0x2aaab416b848,
    inBuf=0x1d3c5498 "INSERT IGNORE INTO testdb_S . t1_temp1_N  ( `col_int_key` , `col_int` , `pk`  ) SELECT `col_int_key` , `col_int` , `pk`  FROM testdb_S . t1_view1_S  WHERE SLEEP( 0.5 * 0.93 * 1 ) = 0 LIMIT 1", length=190,
    parser_state=0x4a0f79b0) at sql_parse.cc:5889
#23 0x00000000006b3ef1 in dispatch_command (command=COM_QUERY,
    thd=0x2aaab416b848,
    packet=0x2aaab40bcc29 "INSERT IGNORE INTO testdb_S . t1_temp1_N  ( `col_int_key` , `col_int` , `pk`  ) SELECT `col_int_key` , `col_int` , `pk`  FROM testdb_S . t1_view1_S  WHERE SLEEP( 0.5 * 0.93 * 1 ) = 0 LIMIT 1", packet_length=190)
    at sql_parse.cc:1114
#24 0x00000000006b541e in do_command (thd=0x2aaab416b848) at sql_parse.cc:800
#25 0x00000000006a3481 in do_handle_one_connection (thd_arg=0x2aaab416b848)
    at sql_connect.cc:1194
#26 0x00000000006a3547 in handle_one_connection (arg=0x2aaab416b848)
    at sql_connect.cc:1133
#27 0x000000382860673d in start_thread () from /lib64/libpthread.so.0
#28 0x0000003827ad3d1d in clone () from /lib64/libc.so.6
Waiting for mysqld with pid 29508 to terminate...

Please have a look into the attached archive.
Log of RQG run with server settings etc.
   ./storage/1276601155/27-5.log
RQG grammars
   conf/runtime/WL5004_data.zz
   ./storage/1276601155/27.yy
The probability to hit the assert is very low.
I will try to simplify the test and reach a better
probability.
[23 Jun 2010 11:51] Matthias Leich
Archive with log and RQG grammars

Attachment: problem.tgz (application/x-compressed-tar, text), 26.74 KiB.

[30 Sep 2010 11:28] Matthias Leich
Problem again observed in
mysql-5.5-runtime last revno ~ end of August
[17 Jan 2011 11:50] Jon Olav Hauglid
This assert has not been seen the last few months even with quite at lot of RQG testing.
Therefore closing the bug as "Can't repeat".
If anyone hits this assert again, please reopen the bug.