Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.51k stars 1.25k forks source link

program with small priority value stop first when run supervisorctl stop all #217

Open ftao opened 11 years ago

ftao commented 11 years ago

Documents says:

The relative priority of the program in the start and shutdown ordering. Lower priorities indicate programs that start first and shut down last at startup and when aggregate commands are used in various clients (e.g. “start all”/”stop all”). Higher priorities indicate programs that start last and shut down first.

But in fact , program with small priority value stop first and start first when run supervisorctl stop all or supervisorctl start all .

(I have read the code , it seems _getAllProcesses always return processes in asc order ..)

SeanHayes commented 10 years ago

I have the same issue.

MrLawes commented 9 years ago

I have the same issue, but when I use: /etc/init.d/supervisor start all /etc/init.d/supervisor stop all It works. But I want to use supervisorctl start all, How should I do

mike-ce commented 8 years ago

I have the same issue. The actual shutdown order seems to be semi-random, but lower-priority processes basically never stop last, like they are supposed to.

The files in this gist can be used to easily demonstrate the problem.

There are two "daemons" requirement.py and daemon.py. The script daemon.py is written in such a way that will raise an exception if a file written by requirement.py does not exist.

If I run supervisord -n -c test.ini I get pretty much what you'd expect. The requirement process is started first.

...
2016-03-03 14:54:47,498 INFO supervisord started with pid 1218
2016-03-03 14:54:48,503 INFO spawned: 'requirement' with pid 1223
2016-03-03 14:54:48,505 INFO spawned: 'daemon_1' with pid 1224
2016-03-03 14:54:48,509 INFO spawned: 'daemon_0' with pid 1225
2016-03-03 14:54:48,512 INFO spawned: 'daemon_2' with pid 1226
2016-03-03 14:54:49,518 INFO success: requirement entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-03-03 14:54:49,518 INFO success: daemon_1 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-03-03 14:54:49,518 INFO success: daemon_0 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-03-03 14:54:49,518 INFO success: daemon_2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

But if I start run supervisorctl -c test.ini and then run stop all, the output from supervisord is:

2016-03-03 14:56:47,398 INFO stopped: daemon_1 (terminated by SIGTERM)
2016-03-03 14:56:47,399 INFO stopped: requirement (terminated by SIGTERM)
2016-03-03 14:56:48,401 INFO stopped: daemon_0 (terminated by SIGTERM)
2016-03-03 14:56:49,406 INFO stopped: daemon_2 (terminated by SIGTERM)