Bug #28953 Using events in a replication let the slave crash.
Submitted: 7 Jun 2007 17:49 Modified: 19 Jun 2007 13:29
Reporter: Horst Hunger Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:5.1.19 OS:Linux (suse 10.1)
Assigned to: Damien Katz CPU Architecture:Any

[7 Jun 2007 17:49] Horst Hunger
Description:
Executing the attached test program let the slave crash. see backtrace in var/slave-data:

Core was generated by `/data0/mysql/mysql-5.1-build/sql/mysqld --no-defaults --console --basedir=/data'.
Program terminated with signal 11, Segmentation fault.

warning: Can't read pathname for load map: Eingabe-/Ausgabefehler.
Reading symbols from /lib/libz.so.1...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/librt.so.1...done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
#0  0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7f615f6 in pthread_kill () from /lib/libpthread.so.0
#2  0x0842f05b in write_core (sig=11) at stacktrace.c:229
#3  0x08275188 in handle_segfault (sig=11) at mysqld.cc:2237
#4  <signal handler called>
#5  0x08283dc4 in sp_process_definer (thd=0x8a3fbe8) at sql_parse.cc:1578
#6  0x08289b59 in mysql_execute_command (thd=0x8a3fbe8) at sql_parse.cc:3200
#7  0x0828df1c in mysql_parse (thd=0x8a3fbe8,
    inBuf=0x8a1f864 "ALTER EVENT ev_rpl_1 ON SCHEDULE AT current_timestamp+INTERVAL 2 SECOND", length=71, found_semicolon=0xb740b264) at sql_parse.cc:5352
#8  0x08356f31 in Query_log_event::do_apply_event (this=0x89edb60, rli=0x8a06218,
    query_arg=0x8a1f864 "ALTER EVENT ev_rpl_1 ON SCHEDULE AT current_timestamp+INTERVAL 2 SECOND", q_len_arg=71) at log_event.cc:2057
#9  0x083575ce in Query_log_event::do_apply_event (this=0x89edb60, rli=0x8a06218)
    at log_event.cc:1907
#10 0x084192f1 in Log_event::apply_event (this=0x89edb60, rli=0x8a06218)
    at log_event.h:815
#11 0x08417090 in exec_relay_log_event (thd=0x8a3fbe8, rli=0x8a06218) at slave.cc:1788
#12 0x08417bf3 in handle_slave_sql (arg=0x8a05398) at slave.cc:2403
#13 0xb7f5d34b in start_thread () from /lib/libpthread.so.0
#14 0xb7e7e65e in clone () from /lib/libc.so.6
(gdb)        

How to repeat:
copy attached prog into mysql-test/t and execute

perl mysql-test-run.pl --suite=events --mysqld=--binlog-format=mixed  rpl_ev_bug11

see rlp_ev_bug11.log and in slave-data the core
[8 Jun 2007 7:10] Sveta Smirnova
Thank you for the report.

Verified as described using last BK sources.
[13 Jun 2007 20:26] 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/28700

ChangeSet@1.2545, 2007-06-13 16:24:21-04:00, dkatz@damien-katzs-computer.local +3 -0
  Bug #28953  	Using events in a replication let the slave crash.
  
  Fixed where the slave code would try to update the Lex->sphead which is NULL on an "alter table" commands.
[16 Jun 2007 4:50] Bugs System
Pushed into 5.1.20-beta
[19 Jun 2007 13:29] 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 bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.20 changelog.