Bug #31354 MySQL binds to port while executing init_file
Submitted: 2 Oct 2007 20:30
Reporter: Harrison Fisk Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.46 OS:Any
Assigned to: CPU Architecture:Any
Tags: bfsm_2007_10_18, init_file

[2 Oct 2007 20:30] Harrison Fisk
Description:
mysqld binds to the port prior to executing init_file.  If init_file takes a long time to execute, then clients will connect and block unable to do anything while the file is executing.

This is similar to the behavior that was changed for InnoDB startup in bug 11707 http://bugs.mysql.com/bug.php?id=11707

How to repeat:
1.  Create a .sql file, such as /tmp/file.sql with:

SELECT sleep(100);

2.  Add the init_file=/tmp/file.sql under the [mysqld] in your my.cnf

3.  Restart MySQL

4.  Try to connect with a client and hang until the 100 seconds is done

Suggested fix:
Bind on the port after the init_file is done running.