Bug #27998 mysqld crashed when executing INSERT DELAYED on a BLACKHOLE table
Submitted: 21 Apr 2007 2:12 Modified: 27 May 2007 19:07
Reporter: Tobias Asplund Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.17/5.1BK OS:Linux
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: crash

[21 Apr 2007 2:12] Tobias Asplund
Description:
INSERT DELAYED on a blackhole table will crash the server.

How to repeat:
mysql> CREATE TABLE bug ( a INT ) ENGINE = BLACKHOLE;
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT DELAYED INTO bug VALUES (10);
Query OK, 1 row affected (0.00 sec)

-- tailing logfile:
070421  3:58:43 - mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

Suggested fix:
Map delayed to a normal insert would probably be good.
[21 Apr 2007 15:52] Miguel Solorzano
Thank you for the bug report.

070421 12:49:04 [Note] /home/miguel/dbs/5.1/libexec/mysqld: ready for connections.
Version: '5.1.18-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread -1263727728 (LWP 3089)]
[New Thread -1263928432 (LWP 3104)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1263928432 (LWP 3104)]
0x08665594 in safe_mutex_lock (mp=0xc, file=0x88095b3 "thr_lock.c", line=1329) at thr_mutex.c:97
97        if (!mp->file)
Current language:  auto; currently c
(gdb) bt full
#0  0x08665594 in safe_mutex_lock (mp=0xc, file=0x88095b3 "thr_lock.c", line=1329) at thr_mutex.c:97
        error = 2
#1  0x08664e51 in thr_upgrade_write_delay_lock (data=0x9c75008) at thr_lock.c:1329
        lock = (THR_LOCK *) 0x0
        _db_func_ = 0x8787d70 "handle_inserts"
        _db_file_ = 0x8787958 "sql_insert.cc"
        _db_level_ = 3
        _db_framep_ = (char **) 0x9c97f1c
#2  0x08305f82 in delayed_insert::handle_inserts (this=0x9c96518) at sql_insert.cc:2254
        error = 140940022
        max_rows = 3031036872
        using_ignore = false
        using_opt_replace = false
        using_bin_log = false
        row = (delayed_row *) 0x1
        _db_func_ = 0x8787e4c "handle_delayed_insert"
        _db_file_ = 0x8787958 "sql_insert.cc"
        _db_level_ = 2
        _db_framep_ = (char **) 0x8669353
#3  0x08307226 in handle_delayed_insert (arg=0x9c96518) at sql_insert.cc:2139
        di = (delayed_insert *) 0x9c96518
        thd = (class THD *) 0x9c96528
        _db_func_ = 0x880cc34 "?func"
        _db_file_ = 0x880cc3a "?file"
        _db_level_ = 1
        _db_framep_ = (char **) 0x0
#4  0x00bac3db in start_thread () from /lib/libpthread.so.0
No symbol table info available.
#5  0x009e026e in clone () from /lib/libc.so.6
No symbol table info available.
(gdb)
[28 Apr 2007 10:34] 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/25665

ChangeSet@1.2649, 2007-04-28 14:37:40+05:00, svoj@mysql.com +3 -0
  BUG#27998 - mysqld crashed when executing INSERT DELAYED
              on a BLACKHOLE table
  
  Using INSERT DELAYED on BLACKHOLE tables could lead to server
  crash.
  
  This happens because delayed thread wants to upgrade a lock,
  but BLACKHOLE tables do not have locks at all.
  
  This patch rejects attempts to use INSERT DELAYED on MERGE
  tables.
[10 May 2007 13:19] Sergey Vojtovich
Docs note: with this fix, 4.1 and 5.0 reject delayed inserts with blackhole. In 5.1 delayed inserts are now supported with blackhole (thanks to fix for BUG#26241). Please update "13.2.4.2. INSERT DELAYED Syntax" manual section accordingly.
[24 May 2007 7:05] Bugs System
Pushed into 5.1.19-beta
[24 May 2007 7:06] Bugs System
Pushed into 5.0.44
[24 May 2007 7:07] Bugs System
Pushed into 4.1.23
[27 May 2007 19:07] Paul Dubois
Noted in 4.1.23, 5.0.44, 5.1.19 changelogs.

For 5.1:
INSERT DELAYED statements for BLACKHOLE tables caused a server crash.
The BLACKHOLE storage engine now supports INSERT DELAYED.

(also updates INSERT DELAYED and BLACKHOLE sections)

For 4.1/5.0:
The BLACKHOLE storage engine does not support INSERT DELAYED
statements, but they were not being rejected.