On Thu, Nov 13, 2008 at 02:41:39PM -0500, Jameson Graef Rollins wrote:
> Hello, Gerrit.  I'm encountering a problem with runit that I'm hoping
> you can help me with.
> 
> It appears that stopped runsv processes are not responding to TERM
> signals.  The big problem that this is causing is that services
> removed with update-service --remove do not die:
> 
> servo:~ 1$ sudo update-service --add /var/lib/cereal/sessions/foo cereal.foo
> Service cereal.foo added.
> servo:~ 0$ pidof runsv
> 27144
> servo:~ 0$ sudo svstat /etc/service/cereal.foo
> /etc/service/cereal.foo: down 51 seconds
> servo:~ 0$ sudo update-service --remove /var/lib/cereal/sessions/foo 
> cereal.foo
> Service cereal.foo removed, the service daemon received the TERM and CONT 
> signals.
> servo:~ 0$ sudo svstat /etc/service/cereal.foo
> /etc/service/cereal.foo: unable to chdir: file does not exist
> servo:~ 0$ ps -eFH | grep [r]unsv
> root      3276     1  0    30    32   0 Oct24 ?        00:00:05   runsvdir -P 
> /etc/service log: 
> ...........................................................................................................................................................................................................................................................................................................................................................................................................
> root     27144  3276  0    27    36   0 14:30 ?        00:00:00     runsv 
> cereal.foo
> servo:~ 0$ pidof runsv
> 27144
> servo:~ 0$ sudo kill -TERM $(pidof runsv)
> servo:~ 0$ pidof runsv
> 27144
> servo:~ 0$ sudo kill -KILL $(pidof runsv)
> servo:~ 0$ pidof runsv
> servo:~ 1$ 

Hi Jameson, see the runsv(8) man page:

SIGNALS
       If runsv receives a TERM signal, it acts as  if  the  character x  was
       written to the control pipe.
and
       x      Exit.   If  the  service  is running, send it a TERM signal, and
              then a CONT signal.  Do not restart the service.  If the service
              is down, and no log service exists, runsv exits.  If the service
              is down and a log service  exists,  runsv  closes  the  standard
              input of the log service, and waits for it to terminate.  If the
              log service is down, runsv exits.  This command is ignored if it
              is given to service/log/supervise/control.

If runsv receives a TERM signal, it sends the service daemon a TERM
signal, and waits for it to terminate.  As long as the service daemon
doesn't terminate, runsv will be running too, I guess that's what's
happening with your services.  IMO the correct fix is to make sure that
the service daemon properly re-acts on a TERM signal.  If that isn't
feasible, you can tell runsv to send a KILL signal (see CUSTOMIZE
CONTROL), or use something like 'sv force-stop
/var/lib/cereal/sessions/foo'.

...Having written that, I see your service is down when removing it
> servo:~ 0$ sudo svstat /etc/service/cereal.foo
> /etc/service/cereal.foo: down 51 seconds

Hmm.  If you can reproduce the issue reliably, can you make the service
directory available, so that I can try to reproduce on my systems?

Thanks, Gerrit.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to