Supervisor / supervisor

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

supervisorctl stop service takes 1 minute #1572

Closed Hansyangxingxiang closed 1 year ago

Hansyangxingxiang commented 1 year ago

supervisorctl stop service takes 1 minute

1 .OS:ubuntu16.04.5 supervisor version:3.3.5 2023-02-03 17:54:59,559 INFO waiting for store to stop 2023-02-03 17:55:01,559 INFO waiting for store to stop 2023-02-03 17:55:03,559 INFO waiting for store to stop 2023-02-03 17:55:05,559 INFO waiting for store to stop 2023-02-03 17:55:07,559 INFO waiting for store to stop 2023-02-03 17:55:09,559 INFO waiting for store to stop 2023-02-03 17:55:11,559 INFO waiting for store to stop 2023-02-03 17:55:13,559 INFO waiting for store to stop 2023-02-03 17:55:15,559 INFO waiting for store to stop 2023-02-03 17:55:17,559 INFO waiting for store to stop 2023-02-03 17:55:19,559 INFO waiting for store to stop 2023-02-03 17:55:21,559 INFO waiting for store to stop 2023-02-03 17:55:23,559 INFO waiting for store to stop 2023-02-03 17:55:25,559 INFO waiting for store to stop 2023-02-03 17:55:27,559 INFO waiting for store to stop 2023-02-03 17:55:29,559 INFO waiting for store to stop 2023-02-03 17:55:31,559 INFO waiting for store to stop 2023-02-03 17:55:33,559 INFO waiting for store to stop 2023-02-03 17:55:35,559 INFO waiting for store to stop 2023-02-03 17:55:37,559 INFO waiting for store to stop 2023-02-03 17:55:39,559 INFO waiting for store to stop 2023-02-03 17:55:41,559 INFO waiting for store to stop 2023-02-03 17:55:43,560 INFO waiting for store to stop 2023-02-03 17:55:45,560 INFO waiting for store to stop 2023-02-03 17:55:47,560 INFO waiting for store to stop 2023-02-03 17:55:49,560 INFO waiting for store to stop 2023-02-03 17:55:51,560 INFO waiting for store to stop 2023-02-03 17:55:53,560 INFO waiting for store to stop 2023-02-03 17:55:55,560 INFO waiting for store to stop 2023-02-03 17:55:57,560 INFO waiting for store to stop 2023-02-03 17:55:59,560 INFO waiting for store to stop 2023-02-03 17:56:01,560 INFO waiting for store to stop 2023-02-03 17:56:02,469 INFO stopped: store (exit status 0)

  1. on ubuntu20.04.1 supervisor version: 4.1.0, No problem
  2. on ubuntu16.04.5 supervisor upgrate to 4.1.0 ,This problem still exists
  3. .I have determined that my program has exited. What is the reason?
  4. The programs I close are as follows:

func (s *Store) Shutdown(retcode int) {

s.ShutingDown = true

C.store_ shutdown()

log.Infof("======================start=============")

zookeeper.CloseZkWithTimeout(zkConn, 2*time.Second)

log.Infof("======================end=============")

os.Exit(retcode) }

  1. The exit log is as follows: INFO[2023-02-03 17:55:03.250709] ======================start============= INFO[2023-02-03 17:55:03.250908] ======================end=============

  2. Of course, not every time, but probability

mnaberez commented 1 year ago
2023-02-03 17:55:49,560 INFO waiting for store to stop
2023-02-03 17:55:51,560 INFO waiting for store to stop
2023-02-03 17:55:53,560 INFO waiting for store to stop
2023-02-03 17:55:55,560 INFO waiting for store to stop
2023-02-03 17:55:57,560 INFO waiting for store to stop
2023-02-03 17:55:59,560 INFO waiting for store to stop
2023-02-03 17:56:01,560 INFO waiting for store to stop
2023-02-03 17:56:02,469 INFO stopped: store (exit status 0)

supervisord detects that a child process has exited by receiving SIGCHLD from it. In the log above, supervisord is waiting to receive the SIGCHLD signal from its child process store to indicate that it has exited.

supervisord will wait up to stopwaitsecs seconds for the child process to exit on its own, as configured in [program:store] in the configuration file. We can see from the many repeated lines in the log file that supervisord is running and waiting for SIGCHLD but has not received it. The child process store has not yet exited. Finally, before stopwaitsecs has expired, the child process store exits on its own with exitstatus 0.

I am going to close this issue because I do see not an indication of a bug in supervisord. The Supervisor developers don't have enough bandwidth to help with running specific programs under supervisord. We use this issue tracker mainly for bugs in Supervisor itself.

Hansyangxingxiang commented 1 year ago

But my project stopwaitsecs=3600. From the log, it seems that everyone has waited for 60s. And from the log of my project, I have determined that my program has expired

[program:store]

autorestart=true

autostart=true

startretries=1000000

startsecs=3

stopwaitsecs=3600

command=/usr/bin/store -d 4 -r 2

redirect_ stderr=true

stdout_ logfile=/var/log/store.log

stopsignal=INT