Public bug reported:

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.

** Affects: sysvinit (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: patch

-- 
sendsigs can kill upstart scripts' child processes
https://bugs.launchpad.net/bugs/639940
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to