Bug #3608 INNODB allows a new process to start when the database is still shutting down.
Submitted: 30 Apr 2004 4:41 Modified: 5 May 2004 10:49
Reporter: Dathan Pattishall Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:4.0.18 OS:Linux (Linux dbmstr2.gbxsc.friendster.c)
Assigned to: Marko Mäkelä CPU Architecture:Any

[30 Apr 2004 4:41] Dathan Pattishall
Description:
INNODB allows a new process to start when the database is still shutting down.

This causes INNODB to possibly corrupt a database.

How to repeat:
Get an AMD opteron with 8 GB of Memory. RUN mysql-64

Load 5.5 GB of INNODB into memory. Cause IO wait on your system. Start a shutdown wait .... start mysql

You'll get these events

040429 19:13:19  Slave I/O thread exiting, read up to log 'db-bin.001', position 206813757

040429 19:13:19  Slave SQL thread exiting, replication stopped in log  'db-bin.001' at position 79347028

040429 19:13:19  InnoDB: Starting shutdown...

/*****
 * INNODB IS STILL TRYING TO SHUTDOWN BUT MYSQLD STARTED!!!
 *
 */

040429 19:17:02  mysqld started

040429 19:17:04  InnoDB: Database was not shut down normally.

InnoDB: Starting recovery from log files...

InnoDB: Starting log scan based on checkpoint at

InnoDB: log sequence number 81 2521444219

Suggested fix:
Hold a shutdown semiphore when a mysqlprocess is shutting down. Do not allow startup if an active mysql-innodb process is shutting down.
[5 May 2004 10:49] Marko Mäkelä
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

ChangeSet@1.1803

InnoDB will now obtain an exclusive advisory lock on all log and data files it opens.  (On Windows, InnoDB already took a mandatory lock on the files.)