Bug #48725 Assert !thd->is_error() in delayed_get_table()
Submitted: 12 Nov 2009 12:38 Modified: 7 Mar 2010 1:34
Reporter: Jon Olav Hauglid Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:6.0.14-bzr, 6.0-codebase-bugfixing OS:Any
Assigned to: Jon Olav Hauglid CPU Architecture:Any
Tags: regression
Triage: Triaged: D1 (Critical)

[12 Nov 2009 12:38] Jon Olav Hauglid
Description:
Concurrent execution of INSERT DELAYED and FLUSH TABLES can give an assert
DBUG_ASSERT(! thd->is_error()); in sql_insert.cc

Backtrace:

#0  __pthread_kill (threadid=<value optimized out>, signo=<value optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:63
#1  0x0000000000bab857 in my_write_core (sig=6) at stacktrace.c:309
#2  0x00000000006fdcd1 in handle_segfault (sig=6) at mysqld.cc:2765
#3  <signal handler called>
#4  0x00007f8ec11e14b5 in *__GI_raise (sig=<value optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x00007f8ec11e4f50 in *__GI_abort () at abort.c:92
#6  0x00007f8ec11da481 in *__GI___assert_fail (assertion=0xdad20f "! thd->is_error()", 
    file=<value optimized out>, line=2047, 
    function=0xdadca0 "bool delayed_get_table(THD*, TABLE_LIST*)") at assert.c:81
#7  0x00000000007c71ce in delayed_get_table (thd=0x25d7360, table_list=0x261f818)
    at sql_insert.cc:2047
#8  0x00000000007c36df in open_and_lock_for_insert_delayed (thd=0x25d7360, 
    table_list=0x261f818) at sql_insert.cc:523
#9  0x00000000007c3a76 in mysql_insert (thd=0x25d7360, table_list=0x261f818, fields=..., 
    values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false)
    at sql_insert.cc:630
#10 0x00000000007137c7 in mysql_execute_command (thd=0x25d7360) at sql_parse.cc:3267
#11 0x000000000071b742 in mysql_parse (thd=0x25d7360, 
    inBuf=0x2480208 "INSERT DELAYED INTO t1 VALUES (1)", length=33, 
    found_semicolon=0x7f8ec27fd8c8) at sql_parse.cc:5979

Handler thread:

#0  PROFILING::status_change (this=0x2765880, status_arg=0x0, 
    function_arg=0xdadbf0 "handle_delayed_insert_impl", file_arg=0xdace6a "sql_insert.cc", 
    line_arg=2479) at sql_profile.cc:311
#1  0x00000000006dd643 in set_thd_proc_info (thd=0x27641a0, info=0x0, 
    calling_function=0xdadbf0 "handle_delayed_insert_impl", 
    calling_file=0xdace6a "sql_insert.cc", calling_line=2479) at sql_class.cc:264
#2  0x00000000007c8711 in handle_delayed_insert_impl (thd=0x27641a0, di=0x2764180)
    at sql_insert.cc:2479
#3  0x00000000007c8c07 in handle_delayed_insert (arg=0x2764180) at sql_insert.cc:2632
#4  0x00007f8ec2325a04 in start_thread (arg=<value optimized out>) at pthread_create.c:300
#5  0x00007f8ec128d7bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

How to repeat:
See bug#48274 for test case.
[12 Nov 2009 13:41] Valeriy Kravchuk
Assertion happens with debug binaries:

Version: '6.0.14-alpha-debug-log'  socket: '/Users/openxs/dbs/6.0-codebase/mysql-test/var/tmp/master.sock'  port: 9306  Source distribution
Assertion failed: (! thd->is_error()), function delayed_get_table, file sql_insert.cc, line 2047.

Does not happen with 5.1.42.
[16 Nov 2009 14:46] Jon Olav Hauglid
Should have been "See bug#48724 for test case."
[17 Nov 2009 13:53] 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/90668

3712 Jon Olav Hauglid	2009-11-17
      Bug #48725 Assert !thd->is_error() in delayed_get_table()
      
      This bug is a regression introduced by the patch for Bug #45949.
      
      If the handler thread for INSERT DELAYED was killed by e.g.
      FLUSH TABLES, the error message is copied from the handler thread
      to the connection thread. But the error was not reacted on, so the
      connection thread continued as normal, leading to an eventual assert.
      
      No test case added as it would have required sync points to work
      for handler threads. The plan is to add this in the scope of 
      Bug #48725 / Bug #48541. The patch has been tested with the 
      non-deterministic test case given in the bug description.
[20 Nov 2009 9:38] Jon Olav Hauglid
Pushed to mysql-6.0-codebase-bugfixing (6.0.14-alpha).
[9 Dec 2009 11:59] Jon Olav Hauglid
Pushed to mysql-next-4284 (5.6.0-beta).
[16 Feb 2010 16:46] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100216101445-2ofzkh48aq2e0e8o) (version source revid:kostja@sun.com-20091211154405-c9yhiewr9o5d20rq) (merge vers: 6.0.14-alpha) (pib:16)
[16 Feb 2010 16:55] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100216101208-33qkfwdr0tep3pf2) (version source revid:kostja@sun.com-20091210084103-l4f8u62u4evoy3dc) (pib:16)
[25 Feb 2010 21:09] Paul Dubois
Noted in 6.0.14 changelog.

If an INSERT DELAYED handler thread was killed by a connection, the
error message was copied from the handler thread to the connection
thread but not acted on, leading to an assert.

Setting report to Need Merge pending push of Celosia to release tree.
[6 Mar 2010 11:08] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100216221947-luyhph0txl2c5tc8) (merge vers: 5.5.99-m3) (pib:16)
[7 Mar 2010 1:34] Paul Dubois
Noted in 5.5.3 changelog.
[12 Apr 2010 16:30] Paul Dubois
Correction: Not in any released version. No changelog entry needed.