Bug #38714 MySQL crashes if the binlog index references log files not existing anymore
Submitted: 11 Aug 2008 10:40 Modified: 11 Aug 2008 16:01
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0.67 OS:Any
Assigned to: CPU Architecture:Any
Tags: qc

[11 Aug 2008 10:40] jocelyn fournier
Description:
Hi,

After upgrading from 5.0.51a to 5.0.67, some of my slaves segfaulted after restart.
It appears after investigation the mysql-log-bin.index was referencing mysql-bin.xxxxxx files which were manually deleted.
With 5.0.51a this doesn't cause any issues, but with 5.0.67 mysql crashes immediately.

There is nothing really usefull in the stacktrace :

key_buffer_size=0
read_buffer_size=8388608
max_used_connections=0
max_connections=1200
threads_connected=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 17203200 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
thd=(nil)
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...
frame pointer is NULL, did you compile with
-fomit-frame-pointer? Aborting backtrace!

Manually removing those invalid entries from the index file solves the issue.

Regards,
  Jocelyn

How to repeat:
Take a slave with the following my.cnf values :

log-slave-updates
log-bin         = /opt/relaylog/mysql-bin.log
log-bin-index   = /opt/relaylog/mysql-log-bin.index
log-error       = /opt/relaylog/log-error.log
expire-logs-days = 8
max_binlog_size  = 1G
relay-log           = /opt/relaylog/mysql-relay.log
relay-log-info-file = /opt/relaylog/relay-log.info
relay-log-index     = /opt/relaylog/relay-log.index
replicate-ignore-db = phpmyadmin
replicate-ignore-db = test
# Pour une base non-search :
replicate-wild-ignore-table=%.search%
replicate-wild-ignore-table=%.finalSearchResult
replicate-wild-ignore-table=%.plop

On the relay-log.index, add references to not existing files.
It should crash mysql.
[11 Aug 2008 16:01] MySQL Verification Team
duplicate of bug #37027