Bug #10798 If relay log fails to rotate, slave will crash after
Submitted: 23 May 2005 9:36 Modified: 26 Feb 2007 20:23
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:4.0 OS:Linux (linux)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[23 May 2005 9:36] Guilhem Bichot
Description:
When relay log rotation fails (for whatever reasons), the relay log is internally marked as "closed" but when the I/O thread later wants to write to it it fails to notice this, so tries to write to a closed log, and it segfaults.

How to repeat:
A user gets it on Linux:
http://forums.mysql.com/read.php?26,16055,26861#msg-26861
and by looking at code it is clear that I/O thread tries to write to an IO_CACHE which has been end_io_cache()d already (so it writes to freed memory).
[18 Dec 2006 11:49] 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/17107

ChangeSet@1.2598, 2006-12-18 15:50:21+04:00, ramil@mysql.com +1 -0
  Fix for bug #10798: If relay log fails to rotate, slave will crash after
  
  The relay log may not be open for some reason (e.g. disk error) after rotation,
  and using it causes the slave crash.
  
  Fix: check we have it open before access, return error otherwise.
[18 Dec 2006 13:09] Guilhem Bichot
approved with minor comments sent by mail
[18 Dec 2006 13:38] 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/17114

ChangeSet@1.2598, 2006-12-18 17:38:59+04:00, ramil@mysql.com +1 -0
  Fix for bug #10798: If relay log fails to rotate, slave will crash after
  
  The relay log may not be open for some reason (e.g. disk error) after rotation,
  and using it causes the slave crash.
  
  Fix: check we have it open before access, return error otherwise.
[14 Feb 2007 14:56] Chad MILLER
Available in 4.1.23, 5.0.36, and 5.1.16-beta.
[26 Feb 2007 20:23] Paul DuBois
Noted in 4.1.23, 5.0.36, 5.1.16 changelogs.

If a slave server closed its relay log (for example, due to an error
during log rotation), the I/O thread did not recognize this and still
tried to write to the log, causing a server crash.