前回は signal 6 のことを書いたので今回は signal 11(segmentation fault)。
MySQL5.6以前の version で Read Replica を使用している場合に、突然再起動することがある。
上記のようなことが起こったら、ログなどから下記の条件に一致するか確認したほうがいい。
前提
Read Replica を利用。
MySQL5.6以前の version を利用。
主に Read Replica側で発生する。
ログに、"FLUSH LOGS" の記録がある。
Log
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (1d9cfek0): flush logs
Connection ID (thread ID): 4
Status: NOT_KILLED
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.
key_buffer_size=16777216
read_buffer_size=262144
max_used_connections=22
max_threads=1441
thread_count=4
connection_count=4
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 3352884 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x1d8c1630
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 = 429200f8 thread_stack 0x40000
/rdsdbbin/mysql/bin/mysqld(my_print_stacktrace+0x2e)[0x7a996e]
/rdsdbbin/mysql/bin/mysqld(handle_fatal_signal+0x3e2)[0x67fd12]
/lib64/libpthread.so.0[0x2b47f50c1b10]
[0x2aae001282f0]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (1d9cfek0): flush logs
Connection ID (thread ID): 4
Status: NOT_KILLED
下記は Percona だが、元は同じ MySQL などで同じことが発生するよう。
Seg fault when "FLUSH LOGS" simultaneously on both Master and Slave
log.cc
rpl_slave.cc
sql_reload.cc
0158 if (options & REFRESH_RELAY_LOG)
0159 {
0160 #ifdef HAVE_REPLICATION
0161 mysql_mutex_lock(&LOCK_active_mi);
0162 if (active_mi != NULL)
0163 {
0164 mysql_mutex_lock(&active_mi->data_lock);
0165 if (rotate_relay_log(active_mi))
0166 *write_to_binlog= -1;
0167 mysql_mutex_unlock(&active_mi->data_lock);
0168 }
0169 mysql_mutex_unlock(&LOCK_active_mi);
0170 #endif
5.6 からの変更点を見る限り、binlog の排他制御で問題があったよう。
まあ、5.6 から binlog の仕組みがかなり変更されたからなー。
現状対策
--
・MySQL5.6以上を利用。
--