Bug #12226 Insert delayed SQL stmt causes mysqld to crash if record already exists
Submitted: 27 Jul 2005 20:49 Modified: 3 Aug 2005 15:47
Reporter: Fred DeVries Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.9/BK Source OS:Linux (linux suse 9.2 & Win2k Server)
Assigned to: Jim Winstead CPU Architecture:Any

[27 Jul 2005 20:49] Fred DeVries
When I execute a delayed insert SQL statement where the result would create a duplicate record the server goes down with a "mysqld got signal 11;"  If the statement is run where it would not cause the duplicate there is no problem.  I can get around this by not using the delayed insert and doing an insert ignore but as this looks like a bug I am reporting it.

insert delayed into orhed(ohorno) values('1G060');

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.

It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 225791 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0x4289959c, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow instructions on how to resolve the stack tra$
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8a63968 = orhed
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.

Number of processes running now: 0
050727 15:54:34  mysqld restarted

How to repeat:
create table test (fld1 integer default 0 not null, primary key (fld1)) engine=myisam;
insert into test(fld1) values(1);
insert delayed into test(fld1) values(1);

This causes mysqld to crash and restart.  It happens every time it do this wether from a remote mysql connector connection or a local mysql.  It does not happen with innodb tables.  It happens on both a Linux Suse 9.2 and a Win2k Server running MySQL Max 5.0.9 installed today.

Suggested fix:
This goes over my head.
[27 Jul 2005 21:22] MySQL Verification Team
Thank you for the bug report.

backtrace on Suse 9.3

50727 18:18:13 [Note] /home/miguel/dbs/5.0/libexec/mysqld: ready for connections.
Version: '5.0.11-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread 1129634736 (LWP 10603)]
[New Thread 1129835440 (LWP 10606)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1129835440 (LWP 10606)]
0x0823ed1f in write_record (thd=0x8e2f830, table=0x8e0a948, info=0x8e30cb8) at sql_insert.cc:1091
1091      thd->lex->current_select->no_error= 0;        // Give error
(gdb) backtrace full
#0  0x0823ed1f in write_record (thd=0x8e2f830, table=0x8e0a948, info=0x8e30cb8) at sql_insert.cc:1091
        error = 121
        trg_error = 0
        key = 0x0
        _db_func_ = 0x4357ebb0 "�C�\b�C\001"
        _db_file_ = 0x8e30c0c ""
        _db_level_ = 139908302
        _db_framep_ = (char **) 0x4357e288
#1  0x08240b4f in delayed_insert::handle_inserts (this=0x8e2f820) at sql_insert.cc:1909
        error = 139907947
        max_rows = 100
        using_ignore = false
        using_bin_log = false
        row = (delayed_row *) 0x8e0b510
---Type <return> to continue, or q <return> to quit---
        _db_func_ = 0x856d38b "\203�020\213E\213]�U\211�203�b\203�fu\b�025�\203�020\213E\b\203x8"
        _db_file_ = 0x4357e358 "8�C\224\005$\b �b\207`\b�006"
        _db_level_ = 1075314880
        _db_framep_ = (char **) 0x4357e338
#2  0x08240594 in handle_delayed_insert (arg=0x8e2f820) at sql_insert.cc:1772
        di = (delayed_insert *) 0x8e2f820
        thd = (class THD *) 0x8e2f830
        _db_func_ = 0x0
        _db_file_ = 0x0
        _db_level_ = 0
        _db_framep_ = (char **) 0x0
        set = {__val = {0 <repeats 32 times>}}
#3  0x4017eaa7 in start_thread () from /lib/tls/libpthread.so.0
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#4  0x402afc2e in clone () from /lib/tls/libc.so.6
No symbol table info available.
[28 Jul 2005 21:44] 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:

[1 Aug 2005 23:59] 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:

[2 Aug 2005 0:08] Jim Winstead
Fixed in 5.0.11.
[3 Aug 2005 15:47] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

Documented fix in 5.0.11 changelog.