Bug #20761 Instance Manager: Signals are not handled correctly
Submitted: 28 Jun 2006 20:55 Modified: 5 Oct 2007 15:17
Reporter: Alexander Nozdrin Email Updates:
Status: Unsupported Impact on me:
None 
Category:Instance Manager Severity:S3 (Non-critical)
Version:5.0.23 OS:FreeBSD (FreeBSD)
Assigned to: CPU Architecture:Any

[28 Jun 2006 20:55] Alexander Nozdrin
Description:
This is a followup of BUG#14106. The problem is that
signals are not handled (or dispatched) correctly
in Instance Manager, so it can not shutdown gracefully.

This problem appears at least on FreeBSD 5.4
(buildb.mysql.com, freebsd5.4-i386).

"Good" platforms at least are:
  - Linux 2.6 i386/amd64;
  - Sun Solaris 10 (sol10-amd64-a.mysql.com, solaris2.10-i386);

How to repeat:
1. Start Instance Manager as a daemon;
2. Send TERM signal to the IM process (not Angel);
3. Investigate log-files and find that IM didn't handled signal.

-----------------------------------------------------------------

Proper behaviour (on linux):

  1. Start Instance Manager:

    $ ./mysqlmanager --defaults-file=../../mysql-test/var/im.cnf --run-as-service --log=/tmp/im.log

  2. /tmp/im.log contains:

060628 22:46:58 IM pid file: '/home/alik/MySQL/devel/5.0-rt-build/mysql-test/var/run/im.pid'; PID: 6343.
060628 22:46:58 Angel pid file: '/home/alik/MySQL/devel/5.0-rt-build/mysql-test/var/run/im.angel.pid'; PID: 6342.
060628 22:46:58 guardian: starting instance mysqld1
060628 22:46:58 starting instance mysqld1
060628 22:46:58 accepting connections on ip socket
060628 22:46:58 accepting connections on unix socket /home/alik/MySQL/devel/5.0-rt-build/mysql-test/var/tmp/im.sock

  3. Send TERM signal:

    $ kill 6343

  4. /tmp/im.log contains:

060628 22:47:21 Listener_thread::run(): shutdown requested, exiting...

So, IM recognised request to stop and shutted down gracefully.

-----------------------------------------------------------------

Buggy behaviour:

  1. Start Instance Manager:

    $ ./mysqlmanager --defaults-file=../../mysql-test/var/im.cnf --run-as-service --log=/tmp/im.log

  2. /tmp/im.log contains:

060628 20:46:14 Angel pid file: '/usr/home/mysqldev/alik/mysql-5.0.23/mysql-test/var/run/im.angel.pid'; PID: 19850.
060628 20:46:14 loaded user im_admin
060628 20:46:14 IM pid file: '/usr/home/mysqldev/alik/mysql-5.0.23/mysql-test/var/run/im.pid'; PID: 19851.
060628 20:46:14 accepting connections on ip socket
060628 20:46:14 guardian: starting instance mysqld1
060628 20:46:14 starting instance mysqld1
060628 20:46:14 accepting connections on unix socket /usr/home/mysqldev/alik/mysql-5.0.23/mysql-test/var/tmp/im.sock

  3. Send TERM signal:

    $ kill -TERM 19581

  4. /tmp/im.log contains:

060628 20:46:35 angel(): mysqlmanager exited abnormally: respawning...
060628 20:46:36 Angel pid file: '/usr/home/mysqldev/alik/mysql-5.0.23/mysql-test/var/run/im.angel.pid'; PID: 19850.
060628 20:46:36 loaded user im_admin
060628 20:46:36 IM pid file: '/usr/home/mysqldev/alik/mysql-5.0.23/mysql-test/var/run/im.pid'; PID: 19862.
060628 20:46:36 accepting connections on ip socket
060628 20:46:36 accepting connections on unix socket /usr/home/mysqldev/alik/mysql-5.0.23/mysql-test/var/tmp/im.sock

So, Angel treated killing of IM-process, as fault and respawned the process.
[27 Jul 2006 11:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/9662