supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Nested runsvdir
@ 2004-09-16 19:13 Jared Rhine
  2004-09-17  2:45 ` mike
  2004-09-19 20:00 ` Gerrit Pape
  0 siblings, 2 replies; 4+ messages in thread
From: Jared Rhine @ 2004-09-16 19:13 UTC (permalink / raw)


Are there any known caveats to "nesting" runsvdir instances?  I'm
having problems with signals and processes reparenting to init.

By nested I mean that an init-started "main" runsvdir has one service
which has a run script of:

-- begin --

#!/bin/sh 
 
exec 2>&1 
 
exec chpst -P -u monitor -e /var/di/monitor/runit/envdir runsvdir -P /var/di/monitor/runit/services 'log: ..........'

-- end --

(Yes, I am running the runsvdir -P patch recently sent by Gerrit; I
get the same behavior without the patch but I thought I should check
to see if it made a difference.  I've tried various combinations of
pgrp switches without effect.)  There are a couple of services defined
under /var/di/monitor/runit/services (call them "router" and
"archiver").  I can start/stop/manipulate these services fine using
runsvctrl.

But if I terminate the "parent" service (via runsvctrl down for
instance), the router and archiver runsv processes don't die; they
instead move to a parent pid of 1.  I can then runsvctrl the router
and archiver services fine.  But this is a bad situation to put the
server in and worse case (except I'm using chpst -L lockfiles), I get
multiple daemons running.  I expect that killing the nested runsvdir
should kill all its child services.

runit is probably doing the expected thing given what I'm thrown at
it, but I don't know what misconfiguration I've done.  I didn't think
this configuration would cause any unusual issues (Solaris 9/sparc) as
the mechanics of signals/waitpid/etc instead a "nested" runsvdir
should be about the same, right?

Suggestions or snippets of working "nested" runsvdir configurations
would be most appreciated.

-- jared@wordzoo.com

"A pessimist is one who has been intimately acquainted with an optimist."
        -- Elbert Hubbard


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Nested runsvdir
  2004-09-16 19:13 Nested runsvdir Jared Rhine
@ 2004-09-17  2:45 ` mike
  2004-09-19 20:02   ` Gerrit Pape
  2004-09-19 20:00 ` Gerrit Pape
  1 sibling, 1 reply; 4+ messages in thread
From: mike @ 2004-09-17  2:45 UTC (permalink / raw)
  Cc: supervision

On Thu, Sep 16, 2004 at 12:13:50PM -0700, Jared Rhine wrote:
> Are there any known caveats to "nesting" runsvdir instances?  I'm
> having problems with signals and processes reparenting to init.

Yeah, I also have these problems. Worked around by bringing down
the child runsvdir's stuff in stage 3 before bringing down the parent,
but there are still a few issues.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Nested runsvdir
  2004-09-16 19:13 Nested runsvdir Jared Rhine
  2004-09-17  2:45 ` mike
@ 2004-09-19 20:00 ` Gerrit Pape
  1 sibling, 0 replies; 4+ messages in thread
From: Gerrit Pape @ 2004-09-19 20:00 UTC (permalink / raw)


On Thu, Sep 16, 2004 at 12:13:50PM -0700, Jared Rhine wrote:
> Are there any known caveats to "nesting" runsvdir instances?  I'm
> having problems with signals and processes reparenting to init.
> 
> By nested I mean that an init-started "main" runsvdir has one service
> which has a run script of:
> 
> -- begin --
> #!/bin/sh 
> exec 2>&1 
> exec chpst -P -u monitor -e /var/di/monitor/runit/envdir runsvdir -P /var/di/monitor/runit/services 'log: ..........'
> -- end --

>               I can start/stop/manipulate these services fine using
> runsvctrl.
> 
> But if I terminate the "parent" service (via runsvctrl down for
> instance), the router and archiver runsv processes don't die; they
> instead move to a parent pid of 1.  I can then runsvctrl the router
> and archiver services fine.  But this is a bad situation to put the
> server in and worse case (except I'm using chpst -L lockfiles), I get
> multiple daemons running.  I expect that killing the nested runsvdir
> should kill all its child services.
> 
> runit is probably doing the expected thing given what I'm thrown at

Yes, see section SIGNALS in runsvdir(8):
       If runsvdir receives a TERM signal, it exits with 0 immediately.

       If runsvdir receives a HUP signal, it sends a TERM signal to each
       runsv(8) process it is monitoring and then exits with 111.

> Suggestions or snippets of working "nested" runsvdir configurations
> would be most appreciated.

I suggest that you run svwaitdown -xk /var/di/monitor/runit/services/*
in the ./finish script of the runsvdir service, just as runit's stage 3
does for the main runsvdir process (stage 2) after it's terminated.
That should fix your problem.

Regards, Gerrit.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Nested runsvdir
  2004-09-17  2:45 ` mike
@ 2004-09-19 20:02   ` Gerrit Pape
  0 siblings, 0 replies; 4+ messages in thread
From: Gerrit Pape @ 2004-09-19 20:02 UTC (permalink / raw)
  Cc: Jared Rhine

On Fri, Sep 17, 2004 at 11:45:49AM +0900, mike@mikebell.org wrote:
> On Thu, Sep 16, 2004 at 12:13:50PM -0700, Jared Rhine wrote:
> > Are there any known caveats to "nesting" runsvdir instances?  I'm
> > having problems with signals and processes reparenting to init.
> 
> Yeah, I also have these problems. Worked around by bringing down
> the child runsvdir's stuff in stage 3 before bringing down the parent,
> but there are still a few issues.

Would you mind to tell us which ones?

Thanks, Gerrit.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-19 20:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-16 19:13 Nested runsvdir Jared Rhine
2004-09-17  2:45 ` mike
2004-09-19 20:02   ` Gerrit Pape
2004-09-19 20:00 ` Gerrit Pape

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).