supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Gerrit Pape <pape@smarden.org>
To: supervision@list.skarnet.org
Subject: Re: sv sometimes won't issue down request
Date: Mon, 27 Jul 2009 09:09:22 +0000 (UTC)	[thread overview]
Message-ID: <loom.20090727T090343-312@post.gmane.org> (raw)
In-Reply-To: <4A633321.1060207@agilent.com>

Earl Chew <earl_chew <at> agilent.com> writes:
> This defect was submitted against the busybox/runit implementation:
> 
> https://bugs.busybox.net/show_bug.cgi?id=461
> 
> > touch /tmp/testservice/down
> > runsv /tmp/testservice &
> > sv once /tmp/testservice
> > sv down /tmp/testservice
> > 
> > The last line attempts to bring down the service, but does nothing.

Issuing 'sv term' would work though.

> Denys Vlasenko wrote:
> 
> > I propose just removing this test:
> > 
> >         if (svstatus.want == *a)
> >                 return 0;
> > 
> > 
> > it seems to be an optimization (and buggy one at that).
> 
> There is similar code in runit 2.0.0:
> 
> > int control(char *a) {
> >   if (svstatus_get() <= 0) return(-1);
> >   if (svstatus[17] == *a) return(0);
> >   if ((fd =open_write("supervise/control")) == -1) {

This patch should handle that special case ('once' followed by 'down').
If sv sees that the service is already scheduled to be down ('want
down'), but no TERM signal has been sent yet (no 'got TERM'), it sends
the 'd' command to runsv.  Does this work for you?

Regards, Gerrit.


diff --git a/src/sv.c b/src/sv.c
index 8269ca7..1a9b4b9 100644
--- a/src/sv.c
+++ b/src/sv.c
@@ -244,7 +244,8 @@ int check(char *a) {
 }
 int control(char *a) {
   if (svstatus_get() <= 0) return(-1);
-  if (svstatus[17] == *a) return(0);
+  if (svstatus[17] == *a)
+    if (*a != 'd' || svstatus[18] == 1) return(0);
   if ((fd =open_write("supervise/control")) == -1) {
     if (errno != error_nodevice)
       warn("unable to open supervise/control");




  parent reply	other threads:[~2009-07-27  9:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13  8:00 Bug for sv status in lsb mode Mathieu Poumeyrol
2009-07-13 13:42 ` Charlie Brady
2009-07-13 14:13   ` Mathieu Poumeyrol
2009-07-13 14:18     ` Mathieu Poumeyrol
2009-07-13 14:20       ` Charlie Brady
2009-07-17  9:08       ` Gerrit Pape
2009-07-17 10:02         ` Mathieu Poumeyrol
2009-07-17 11:08           ` Gerrit Pape
2009-07-19 14:52         ` sv sometimes won't issue down request Earl Chew
2009-07-19 17:14           ` svwaitup races with sv Earl Chew
2009-07-24 20:31             ` Charlie Brady
2009-07-24 20:35               ` Earl Chew
2009-07-24 20:18           ` sv sometimes won't issue down request (specifically, after 'sv once xxx') Charlie Brady
2009-07-24 20:38             ` Earl Chew
2009-07-24 21:01               ` Charlie Brady
2009-07-25 19:49                 ` Joan Picanyol i Puig
2009-07-27  9:09           ` Gerrit Pape [this message]
2009-07-27 17:39             ` sv sometimes won't issue down request Earl Chew
2010-05-31 19:54         ` Bug for sv status in lsb mode Erik Wright
2010-06-03  9:04           ` Gerrit Pape
2010-06-03 14:12             ` Erik Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20090727T090343-312@post.gmane.org \
    --to=pape@smarden.org \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).