Hi Jonas, On Thu, 14 Dec 2017 10:53:11 +0100 Jonas Meurer <jo...@freesources.org> wrote: > > Am 14.12.2017 um 01:14 schrieb Stephen Rothwell: > > The sysv init script will fail to do a stop or restart: > > Thanks a lot for all the bugreports regarding the init script. As you > might have seen, the initscript didn't get much testing yet. PEB and me > both use systemd and it seems like we neglected the sysvinit script.
Thanks for your great short turnarounds on these issues. > > --die-on-term is passed to uwsgi, so a TERM signal is needed > > to stop it instead of HUP > > That's a valid point. I now looked into the sysvinit script > uswgi-core[1] again as reference and it uses '--retry=QUIT/30/KILL/5'. > > > uwsgi takes some time to terminate, so a following start may fail > > if it is still stopping > > stop sill fail if uwsgi is not actually running (which makes > > restart fail) > > > > To fix all this, I changed do_stop to do: > > > > start-stop-daemon --stop --quiet --oknodo --retry forever/TERM/5 \ > > --pidfile $PIDFILE --exec $DAEMON > > > > The "forever" may not be a good choice ... maybe "TERM/5/KILL/5" or > > some such would be better. And 5 seconds may also not be a good choice, > > but it seems to work fairly well on my setup. > > I don't like to use 'forever'. Something like 'QUIT/30/KILL/5' looks way > better: It sends the 'QUIT' signal, waits for 30 seconds and then sends > the KILL signal (waiting for 5 seconds). If neither succeeds, the stop > process fails. That seems sensible to me. OK, so using 'QUIT/30/KILL/5' means that the "stop" action sits around for 30 seconds and then the KILL gets sent. It seems that uwsgi is ignoring the QUIT. Maybe 'TERM/30/KILL/5'? After I made that change, "stop" and "restart" work as expected and fairly fast. Alternatively, removing "--die-on-term" from DAEMON_ARGS makes 'QUIT/30/KILL/5' work fine. > > I am also not sure that the {forced-}reload actions are going to work. > > Indeed, I updated them as well according to the uwsgi-core sysvinit > script[1]. > > Could you give that attached updated init script a try and report back? > Please test all of the start/stop/restart/reload/force-reload functions. OK, I tried start/stop/restart/reload/force-reload anbd all seemd to work as expected *after* I removed "--die-on-term" from DAEMON_ARGS (using 'QUIT/30/KILL/5' for stopping). > > Also, maybe start-stop-daemon is not needed for uwsgi as it seems to do > > its own process management? > > Not sure about that. The uwsgi package uses start-stop-daemon as well. > As that's the common way to handle daemons with sysvinit in Debian, I > think we should stick to it. Yes, no problem. -- Cheers, Stephen Rothwell