[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Faster shutdown and the ubuntu "multiuser" update-rc.d extention



On Thu, Jan 03, 2008 at 10:40:32AM -0800, Steve Langasek wrote:

> It's also, as commented already in the init script, recognized as a bug in
> the associated daemon.  Fixing that bug would drop the need for the sleep,
> though if there's a possibility of SIGKILL coming before the daemon is done
> shutting down then you still don't have a guaranteed cleanup, and there's no
> good "wait for process termination" facility that we can use from init
> scripts.

Yep, "waiting for an unrelated process to exit" is surprisingly hard to
do correctly. I wonder if the processor connector support in recent
kernels could be used to create a "kill_and_wait" utility:

- start listening on netlink for process-related events
- send the signal to the process
- wait until we receive a notification that the process has died (or a
  timeout has occured).
- from time to time do a kill(pid, 0) just to be sure we did not loose
  netlink messages

Non-linux ports could fall back to sending kill(pid, 0) in a loop.

Gabor

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------


Reply to: