Bug #36228 Wrong error message returned from server shutting down
Submitted: 21 Apr 2008 11:44 Modified: 29 Apr 2008 22:19
Reporter: Magnus Blåudd Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.0, 5.1, 6.0 BK OS:Any
Assigned to: CPU Architecture:Any

[21 Apr 2008 11:44] Magnus Blåudd
Description:
When the MySQL Server is shutting down, it will still accept conections and it's then possible for it ro reject that connection with a somewhat strange error message "Too many connections" instead of the "Server is shutting down"

This is most likely due to the following code in mysqld.cc, where both max_connections and abort_loop gives the same error. The abort_loop should return the "Server is shutting down" error. Well, even better would maybe be if the connection was not accepted at all?

 if (connection_count >= max_connections + 1 || abort_loop)
  {
    pthread_mutex_unlock(&LOCK_connection_count);

    DBUG_PRINT("error",("Too many connections"));
    close_connection(thd, ER_CON_COUNT_ERROR, 1);
    delete thd;
    DBUG_VOID_RETURN;
  }

How to repeat:
Start a program that continously connects to a started MySQL Server
Shut down the server.
The connecting program would get several errors and occasionally it will get the  ER_CON_COUNT_ERROR

Suggested fix:
Use a separate if for abort_loop
[29 Apr 2008 22:19] Sveta Smirnova
Thank you for the report.

Verified as described.