From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1980 Path: news.gmane.org!not-for-mail From: Gerrit Pape Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: sv sometimes won't issue down request Date: Mon, 27 Jul 2009 09:09:22 +0000 (UTC) Message-ID: References: <8F9355C5-C168-4AD7-8B6C-502416E7EECC@zoy.org> <94175859-2733-4ACF-85E9-DD5FF627F23B@zoy.org> <17A739BC-94BA-4611-A523-6978934F0D61@zoy.org> <4A633321.1060207@agilent.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1248685787 7184 80.91.229.12 (27 Jul 2009 09:09:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jul 2009 09:09:47 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-2215-gcsg-supervision=m.gmane.org@list.skarnet.org Mon Jul 27 11:09:37 2009 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.50) id 1MVMDA-0008P4-Me for gcsg-supervision@gmane.org; Mon, 27 Jul 2009 11:09:36 +0200 Original-Received: (qmail 10629 invoked by uid 76); 27 Jul 2009 09:10:54 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 10619 invoked from network); 27 Jul 2009 09:10:54 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 54 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 77.245.32.76 (Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.9) Gecko/2009050519 Iceweasel/3.0.6 (Debian-3.0.6-1)) Original-Sender: news Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1980 Archived-At: Earl Chew 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");