Bug #9444 Wrong chkconfig priorities in startup script for Red Hat
Submitted: 29 Mar 2005 6:57 Modified: 4 May 2005 13:33
Reporter: Bernard Treine Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:MySQL-server-4.1.9-0 OS:Linux (Red Hat 9)
Assigned to: Lenz Grimmer CPU Architecture:Any

[29 Mar 2005 6:57] Bernard Treine
Description:
Configuration:
Intel platform
Red Hat Linux 9.0
MySQL-server-4.1.9-0

Other services:
Apache httpd
Apache tomcat

Background:

Red Hat uses the chkconfig system for init priorities of services.

When speaking of startup priority, then shutdown priority is
equally important, just in reverse order.

When MySQL is installed with the Apache httpd web server and application servers that work in cooperation with httpd, then the startup sequence of MySQL, Apache httpd and the application servers is critical.

It is critical, because:

a) The Application servers must be started before Apache httpd so that
   Apache connectors find working connections to the application servers.
b) The application servers find working connections to MySQL.

This dictates the following startup sequence (expected behavior):

1) MySQL
2) Application servers
3) Apache httpd

Actual behavior:

MySQL is started after Apache httpd.

So in order to be practical, MySQL's startup priority should be significantly higher (at least 2 lower in number) than Apache httpd.

A gap is required so that Application servers can be placed between MySQL
and Apache httpd.

More specific background:

In a default Apache Tomcat server with Apache mod_jk installation, an unrecoverable error occurs at present under these conditions:

If a servlet is set to be initialised at startup, and if it requires to set up database connections at startup (which is typical),
then its startup fails.

Any subsequent requests from the Apache httpd connector also fail because the servlet has been flagged unavailable.

This scenario can be avoided if MySQL is running before Apache Tomcat startup.

How to repeat:
Refer to above

Suggested fix:
Refer to above
[29 Mar 2005 7:01] Bernard Treine
Correction:

It is critical, because:

a) Apache httpd must find working connections to the application servers.
b) The application servers must find working connections to MySQL.
[29 Apr 2005 12:14] Lenz Grimmer
Correct, our current init script starts mysqld quite late in the startup sequence. This can be modified by changing the following line in /etc/init.d/mysql (when installing the MySQL-server RPM), or in the mysql.server shell script:

# chkconfig: 2345 90 20

In order to resolve this bug I would need to know the startup priorities of these other middleware applications and the web server. Would it be possible for you to post the chkconfig priority levels contained in the init scripts of these other applications? Then we can change the value accordingly. Thanks!
[4 May 2005 12:51] Lenz Grimmer
Looking at the MySQL 3.23.58 RPM included in Red Hat Enterprise Linux 3 reveals:

# chkconfig: - 64 36

The same line appears in the init script for MySQL 4.1.10a included in RHAS4:

# chkconfig: - 64 36

I will adjust our current start and stop priority levels to match these - this should make it easier to replace the shipped version of MySQL with our RPMs without breaking the boot order.
[4 May 2005 13:33] Lenz Grimmer
Fix pushed into 4.1 and 5.0 - will appear in 4.1.12 and 5.0.6