Bug #68604 MySQL crashes trying to start slave
Submitted: 7 Mar 2013 20:13 Modified: 7 May 2013 5:31
Reporter: Kolbe Kegel Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:5.6.10 OS:Any
Assigned to: CPU Architecture:Any

[7 Mar 2013 20:13] Kolbe Kegel
Description:
After starting a brand new 5.6.10 instance, and loading slave_master_info from another instance, and then restarting the new instance, mysqld crashes when trying to initialize the slave.

How to repeat:
Set up new MySQL 5.6.10 instance with mysql_install_db
Start MySQL instance with this configuration:
[mysqld]
server-id=2
port=4002
datadir=/Users/kolbe/Devel/m/5.6/box2
socket=/Users/kolbe/Devel/m/5.6/box2/mysql.sock
log-bin=box2
log-error=prosimmon.err
log-slave-updates
master-info-repository=TABLE
relay-log-info-repository=TABLE
gtid_mode=ON
enforce-gtid-consistency

Load these statements:

SET @@GLOBAL.GTID_PURGED='075f2616-8508-11e2-a100-2d636aea58f7:1-53';
INSERT INTO `slave_master_info` VALUES (23,'box1.000010',191,'127.0.0.1','root','',4001,60,0,'','','','','',0,1800,'','0','075f2616-8508-11e2-a100-2d636aea58f7',86400,'','',1);

Restart MySQL instance
MySQL will crash.

kolbe@prosimmon 5.6 $ rm -rf ./box2/*

kolbe@prosimmon 5.6 $ ./scripts/mysql_install_db --datadir=box2 >/dev/null

kolbe@prosimmon 5.6 $ cat box2.cnf
[mysqld]
server-id=2
port=4002
datadir=/Users/kolbe/Devel/m/5.6/box2
socket=/Users/kolbe/Devel/m/5.6/box2/mysql.sock
log-bin=box2
log-error=prosimmon.err
log-slave-updates
master-info-repository=TABLE
relay-log-info-repository=TABLE
gtid_mode=ON
enforce-gtid-consistency
#binlog-format=row

kolbe@prosimmon 5.6 $ mysqld_safe --defaults-file=box2.cnf &
[1] 17429
130307 15:06:30 mysqld_safe Logging to '/Users/kolbe/Devel/m/5.6/box2/prosimmon.err'.
chown: /Users/kolbe/Devel/m/5.6/box2/prosimmon.err: Operation not permitted
130307 15:06:30 mysqld_safe Starting mysqld daemon with databases from /Users/kolbe/Devel/m/5.6/box2

kolbe@prosimmon 5.6 $ cat slave_master_info.sql
SET @@GLOBAL.GTID_PURGED='075f2616-8508-11e2-a100-2d636aea58f7:1-53';
INSERT INTO `slave_master_info` VALUES (23,'box1.000010',191,'127.0.0.1','root','',4001,60,0,'','','','','',0,1800,'','0','075f2616-8508-11e2-a100-2d636aea58f7',86400,'','',1);

kolbe@prosimmon 5.6 $ ./bin/mysql -S ./box2/mysql.sock mysql < slave_master_info.sql

kolbe@prosimmon 5.6 $ kill %1

kolbe@prosimmon 5.6 $ 130307 15:06:39 mysqld_safe mysqld from pid file /Users/kolbe/Devel/m/5.6/box2/prosimmon.pid ended

[1]+  Done                    mysqld_safe --defaults-file=box2.cnf

kolbe@prosimmon 5.6 $ mysqld_safe --defaults-file=box2.cnf &
[1] 17632

kolbe@prosimmon 5.6 $ 130307 15:06:44 mysqld_safe Logging to '/Users/kolbe/Devel/m/5.6/box2/prosimmon.err'.
chown: /Users/kolbe/Devel/m/5.6/box2/prosimmon.err: Operation not permitted
130307 15:06:44 mysqld_safe Starting mysqld daemon with databases from /Users/kolbe/Devel/m/5.6/box2
130307 15:06:44 mysqld_safe mysqld restarted
130307 15:06:45 mysqld_safe mysqld restarted
130307 15:06:46 mysqld_safe mysqld restarted
130307 15:06:47 mysqld_safe mysqld restarted

kolbe@prosimmon 5.6 $ kill -9 %1
[1]+  Killed: 9               mysqld_safe --defaults-file=box2.cnf

Thread pointer: 0x0
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...
stack_bottom = 0 thread_stack 0x40000
0   mysqld                              0x000000010c93e81e my_print_stacktrace + 44
1   mysqld                              0x000000010c79d9c0 handle_fatal_signal + 705
2   libsystem_c.dylib                   0x00007fff8abce8ea _sigtramp + 26
3   ???                                 0x0000000000000600 0x0 + 1536
4   mysqld                              0x000000010c90b6c1 _Z10init_slavev + 399
5   mysqld                              0x000000010c8d679a _Z11mysqld_mainiPPc + 9565
6   mysqld                              0x000000010c6ac794 start + 52
7   ???                                 0x000000000000000a 0x0 + 10
[7 Mar 2013 20:22] Kolbe Kegel
This seems to happen because slave_relay_log_info is empty (I guess)... if you execute this INSERT along with the INSERT into slave_master_info, MySQL will start up without any problem:

INSERT INTO `slave_relay_log_info` VALUES (7,'./prosimmon-relay-bin.000041',4464,'box1.000010',4264,0,0,1);
[8 Mar 2013 12:31] Erlend Dahl
Thank you for the bug report. Verified as described on 5.6.10.
[7 May 2013 5:31] Erlend Dahl
Jon Stephens:

Documented bug fix in the 5.6.12 and 5.7.2 changelogs as follows:

      Restarting the server after the slave_relay_log_info table had been
      emptied caused mysqld to fail while trying to return an error.

Closed.