[Bug 639940] Re: sendsigs can kill upstart scripts' child processes prematurely on system shutdown
Ćukasz Zemczak
639940 at bugs.launchpad.net
Fri Sep 9 15:53:21 UTC 2022
** Changed in: sysvinit (Ubuntu)
Status: Triaged => Won't Fix
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to sysvinit in Ubuntu.
https://bugs.launchpad.net/bugs/639940
Title:
sendsigs can kill upstart scripts' child processes prematurely on
system shutdown
Status in sysvinit package in Ubuntu:
Won't Fix
Bug description:
Binary package hint: sysvinit
sendsigs can kill child processes executed as part of upstart
pre/post-stop scripts. It successfully omits upstart processes
(daemons and the script processes themselves), but if you use anything
other than shell builtins in an upstart job script, those shell-
spawned processes don't wind up in OMITPIDS and killall5 kills them.
For example, 143 (15/SIGTERM) ends up in /tmp/foo with a script like
this.
pre-stop script
sleep 30 || echo $? >/tmp/foo
end script
Also, the post-SIGTERM loop ends prematurely because killall5 supports
a maximum of 16 omitted processes (LP#634460). In my case, the ssh
(LP#603363), portmap, statd, and (obviously) rc upstart jobs are still
running. Each iteration of the post-SIGTERM loop duplicates these
processes in OMITPIDS. On the fifth iteration, the list overflows and
killall5 terminates with exitstatus 1. The loop terminates
prematurely, since it interprets killall5 failure as an indicator that
all SIGTERMed processes have terminated.
The attached sendsigs fixes both problems. It won't kill processes
that are children of upstart processes. In doing so, it avoids the use
of killall5(1), allowing SIGTERMed processes the full ten seconds to
shut down gracefully before SIGKILL. If killall5 had parent process
checking, using that would be faster, but the fixed omitpid list size
would still be a problem. Doing it "by hand" in the shell is
reasonably fast, since there shouldn't be many processes still
running.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/639940/+subscriptions
More information about the foundations-bugs
mailing list