Bug #37027 expire_logs_days and missing binlogs cause a crash !
Submitted: 28 May 2008 5:07 Modified: 28 Jul 2008 18:11
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S1 (Critical)
Version:5.0.60,5.0.64 OS:Any
Assigned to: Kristofer Pettersson CPU Architecture:Any
Tags: expire_logs_days, regression

[28 May 2008 5:07] Shane Bester
Description:
in recent 5.0 builds, expire_logs_days prints a message when binlogs cannot be found.  this causes a crash on startup.

On windows the stack trace is:

mysqld.exe!push_warning
mysqld.exe!push_warning_printf
mysqld.exe!MYSQL_LOG::purge_logs_before_date
mysqld.exe!init_server_components
mysqld.exe!win_main
mysqld.exe!mysql_service
mysqld.exe!main

On linux the lower frames are the same.
thd was null pointer.

5.1.26 didn't crash. instead it printed the warning and exited.

How to repeat:
startup mysqld with --log-bin=mysql-bin and create some binlogs, for example
create table t1(id int);
flush logs;
create table t2(id int);
flush logs;
create table t3(id int);
flush logs;
create table t4(id int);
flush logs;

now shutdown mysqld.
set system date forward a couple of days (or wait a few days)
rename mysql-bin.000003 to mysql-bin.000003.gone
startup mysqld with --log-bin=mysql-bin --expire-logs-days=1
crash
[28 May 2008 5:11] MySQL Verification Team
D2: breaks upgrades if binlogs are missing (and mysqld crashes in a loop, and if core files are enabled, fills the disk)
W4: remove expire_logs_days or manually edit the .index file to fix
I3: common usecase. many users have missing binlogs (hence we requested warnings)
[28 May 2008 5:16] MySQL Verification Team
bug was introduced in 5.0.60 due to the fix for bug #18199 and bug #18453
[17 Jul 2008 12:25] 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/49918

2644 Kristofer Pettersson	2008-07-24
      Bug#37027 expire_logs_days and missing binlogs cause a crash !
      
      If the server failed to expired log files during start up it could crash.
[22 Jul 2008 18:33] Bugs System
Pushed into 5.0.68
[28 Jul 2008 13:08] Georgi Kodinov
Pushed in 5.1.28 and 6.0.7-alpha
[28 Jul 2008 13:46] Bugs System
Pushed into 5.0.68  (revid:kpettersson@mysql.com-20080724122821-np0iogu0fbtczkk7) (pib:2)
(Retry automatic marking, to ensure nothing is missed. cm01)
[28 Jul 2008 14:45] Bugs System
Pushed into 6.0.7-alpha  (revid:alik@mysql.com-20080725172155-fnc73o50e4tgl23k) (version source revid:alik@mysql.com-20080725172155-fnc73o50e4tgl23k) (pib:3)
[28 Jul 2008 16:45] Bugs System
Pushed into 5.1.28  (revid:davi.arnaut@sun.com-20080722182431-0i2f1yc4uocime9q) (version source revid:davi.arnaut@sun.com-20080722182431-0i2f1yc4uocime9q) (pib:3)
[28 Jul 2008 18:11] Paul DuBois
Noted in 5.0.68 changelog.

If the server failed to expire binary log files at startup, it could
crash.

(No 5.1 or 6.0 changelog because this was a 5.0-only problem.)
[11 Aug 2008 16:02] MySQL Verification Team
bug #38714 was marked as a duplicate of this
[14 Sep 2008 0:46] Bugs System
Pushed into 6.0.7-alpha  (revid:kpettersson@mysql.com-20080724122821-np0iogu0fbtczkk7) (version source revid:vvaintroub@mysql.com-20080804094710-jb2qpqxpf2ir2gf3) (pib:3)
[7 Oct 2008 8:45] Sveta Smirnova
Bug #39881 was marked as duplicate of this one.