Comment 47 for bug 326768

Revision history for this message
Mathias Gug (mathiaz) wrote :

Thanks to the careful and detailed analysis of Stephane in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=527623, it seems that there are two issues:

==========================================================
SIGHUP, SIGQUIT, SIGINT ignored after package installation

After an apt-get install SIGHUP (as well as SIGQUIT and SIGINT) is ignored by mysqld_safe. This is due to the fact that apt blocks SIGHUP, SIGQUIT and SIGINT which is propagated to dpkg, the maintainer shell scripts, the mysql init shell script and finally mysqld_safe (a shell script). However SIGTERM is not.

What are the consequences? A mysql refresh command cannot be sent to mysqld by sending a SIGHUP to mysqld_safe.

Since SIGTERM is not ignored mysqld_safe can properly shutdown mysqld.

It seems that this issue is not related to the bug described here and new bug should be opened instead.

===============================================================
SIGTERM may be ignored when bash is the default shell (/bin/sh)

If /bin/sh points to bash (not the default configuration), SIGHUP (and other signals) will *always* be ignored by mysqld_safe after the first SIGHUP has been sent to mysqld_safe. This is a change in behavior brought by the new upload.

The consequences are similar to the ones mentionned above with the added case that SIGTERM will also be ignored. While this is more problematic, it should be noted that the mysql init script tries *first* to shutdown mysqld via mysqladmin, and uses SIGTERM on mysqld (and not mysqld_safe) if it fails, and then SIGKILL on mysqld (and not mysqld_safe) if SIGTERM fails.

Before the upload the behavior was that on every SIGHUP (regardless of the shell), mysqld_safe would kill mysqld (via SIGKILL) and restart mysqld. Since mysqld was killed with SIGKILL a proper shutdown was *not* done, which could lead to data corruption.

The proposed upload removes a potential data corruption for mysqld except in the case where bash is used as the default shell (/bin/sh).

In this non-default configuration (bash as the default shell):

  * sending a SIGHUP to mysqld_safe would lead to:
    - before (ubuntu10): mysqld killed with SIGKILL and restarted (potential data corruption)
    - after (ubuntu10.2): refresh the first time, nothing on subsequent signaling.
    This is the bug reported here and the upload provides an improvement.

  * sending a SIGTERM to mysqld_safe would lead to:
    - before (ubuntu10): proper shutdown of mysqld
    - after (ubuntu10.2): proper shutdown of mysqld if no SIGHUP has been sent before, nothing if a SIGHUP has already been sent to mysqld_safe.
    This is a regression.

    However it should be noted that the mysql init script doesn't send signals to mysqld_safe when stopping mysql and is run before the sendsigs script during the system shutdown process (rc6).