Bug #38856 mysql crash with 'expire-logs-days' when binlog file isn't found in binlog.index
Submitted: 18 Aug 2008 13:38 Modified: 18 Aug 2008 16:47
Reporter: Kenny Gryp Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.66-br26089-enterprise-gpl-log OS:Linux (2.6.25.4)
Assigned to: CPU Architecture:Any
Tags: crash, expire-logs-days

[18 Aug 2008 13:38] Kenny Gryp
Description:
MySQL crashes when started with the 'expire-logs-days' and with a false entry in binlog.index

Output on mysql.err file:
080818 15:11:49 - 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.

key_buffer_size=0
read_buffer_size=2097152
max_used_connections=0
max_connections=5000
threads_connected=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 51200000 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...
Cannot determine thread, fp=0x48a58095, backtrace may not be correct.
Bogus stack limit or frame pointer, fp=0x48a58095, stack_bottom=0x7fffd1e20000, thread_stack=202752, aborting backtrace.
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

<sidenote>PURGE BINARY LOGS BEFORE '2008-08-18 15:07:00' does not crash the server</sidenote>

How to repeat:
Mysql was configured with expire-logs-days=3

With MySQL not running, I removed the last binlog file and forgot to remove the file entry in the binlog.index file. 
Then I start MySQL and it crashes.

It doesn't crash when expire-logs-days is not set.

# my_print_defaults mysqld:
--port=3306
--socket=/tmp/mysql.sock
--pid-file=/var/lib/mysql/mysqld.pid
--datadir=/var/lib/mysql/
--basedir=/usr/
--keep_files_on_create
--default-storage-engine=MyISAM
--thread_stack=198K
--skip-external-locking
--log-error=/var/log/mysql/mysql.err
--log-warnings=2
--long_query_time=3
--log-slow-queries=/var/log/mysql/mysql-slow.log
--skip-bdb
--skip-innodb
--back_log=4096
--connect_timeout=45
--wait_timeout=50
--net_read_timeout=50
--net_write_timeout=50
--max_allowed_packet=1M
--max_connections=5000
--max_connect_errors=5000
--open-files-limit=131072
--thread_cache_size=2048
--table_cache=32768
--concurrent_insert=1
--key_buffer=4G
--tmp_table_size=1G
--sort_buffer=8M
--record_buffer=5M
--read_buffer_size=2M
--read_rnd_buffer_size=8M
--max_heap_table_size=64M
--query_cache_limit=1048576
--query_cache_size=0
--query_cache_type=0
--master-info-file=/var/lib/mysql/master.info
--relay-log-info-file=/var/lib/mysql/relay-log.info
--relay-log=/var/lib/mysql/relay-bin
--relay-log-index=/var/lib/mysql/relay-bin.index
--replicate-wild-ignore-table=%.XTRA_%
--replicate-wild-ignore-table=%.debug%
--replicate-wild-ignore-table=%.EMAIL_BLACKLIST
--replicate-wild-ignore-table=%.EMAIL_BOUNCED
--replicate-wild-ignore-table=%.INVITATION_UNIQUE_EMAILS
--replicate-wild-ignore-table=%.temp_norep_%
--log-bin=/var/log/mysql/mysql-bin.log
--max_binlog_size=104857600
--log-slave-updates
--binlog-do-db=test
--expire-logs-days=3
--server-id=18

Suggested fix:
Suggested Workaround: don't use expire-logs-days or don't forget to make sure that the binlog.index is consistent.

Suggested Fix: display error when binlog file is not found and exit mysql (it's not yet started anyway).
[18 Aug 2008 15:51] MySQL Verification Team
duplicate of bug #37027
[18 Aug 2008 16:47] Sveta Smirnova
Thank you, Shane :)

Closed as duplicate.