ISEexchange / tacstack

Stack with apache, mysql, php, and python
GNU General Public License v3.0
3 stars 4 forks source link

supervisor does not stop mysqld #52

Open cbautista1002 opened 9 years ago

cbautista1002 commented 9 years ago

When I tell supervisor to stop the mysql service, it claims that it did, but it does not:

supervisor> stop mysql
mysql: stopped
supervisor> exit

bash-4.3# ps -ef | grep -i mysql
62445 mysql      0:26 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock

It then fails to start it (since it was never stopped):

bash-4.3# supervisorctl start mysql
mysql: ERROR (abnormal termination)

The mysqld log files shows that it cannot start if its already running:

bash-4.3# tail -f /var/log/mysqld.log
150409 22:31:53 mysqld_safe A mysqld process already exists
150409 22:31:54 mysqld_safe Logging to '/var/log/mysqld.log'.
150409 22:31:54 mysqld_safe A mysqld process already exists
150409 22:31:54 mysqld_safe A mysqld process already exists
150409 22:31:56 mysqld_safe Logging to '/var/log/mysqld.log'.
150409 22:31:56 mysqld_safe A mysqld process already exists
150409 22:31:56 mysqld_safe A mysqld process already exists
150409 22:31:59 mysqld_safe Logging to '/var/log/mysqld.log'.
150409 22:31:59 mysqld_safe A mysqld process already exists
150409 22:31:59 mysqld_safe A mysqld process already exists

If I kill mysqld then supervisor is able to start it:

bash-4.3# kill -9 62445
bash-4.3# supervisorctl start mysql
mysql: started
bash-4.3# supervisorctl status
httpd                            RUNNING   pid 61645, uptime 0:12:37
map                              RUNNING   pid 62468, uptime 0:12:04
mysql                            RUNNING   pid 63350, uptime 0:00:07
sshd                             RUNNING   pid 61646, uptime 0:12:37
cuu commented 7 years ago

mysql ignores ctrl+c SIGINT

danepowell commented 2 years ago

http://manpages.ubuntu.com/manpages/bionic/man1/pidproxy.1.html

Some processes (like mysqld) ignore signals sent to the actual process which is spawned by supervisord. Instead, a "special" thread/process is created by these kinds of programs which is responsible for handling signals. This is problematic because supervisord can only kill a process which it creates itself. If a process created by supervisord creates its own child processes, supervisord cannot kill them.