supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Earl Chew <earl_chew@agilent.com>
To: supervision@list.skarnet.org
Subject: svwaitup races with sv
Date: Sun, 19 Jul 2009 10:14:31 -0700	[thread overview]
Message-ID: <4A635477.6030503@agilent.com> (raw)
In-Reply-To: <4A633321.1060207@agilent.com>

The script below generates the following output:

> down: ./svc: 0s
> svwaitup: warning: ./svc: is down.
> .... WaitUp 1
> Try again
> run: ./svc: (pid 8496) 2s, normally down, want down

It illustrates a race between runsv/sv and svwaitup.

Commenting out the "touch svc/down" leads to other strange
results like:

> run: ./svc: (pid 8651) 0s
> svwaitup: warning: ./svc: unable to change directory: file does not exist
> .... WaitUp 1
> Try again
> run: ./svc: (pid 8651) 4s, want down


The key is that sv(8) writes its command and simply exits. There is
no way to determine if the command has actually been acted upon.

For example, the following appears to synchronise ok but is a bit
clunky:

    rm svc/supervise/pid
    ../command/sv once ./svc
    while [ -e svc/supervise/pid ] ; do
      sleep 1
    done

It would be better if sv(8) itself could synchronise.

Earl

-----------------------------------------------------------------------

#!/bin/sh

rm -rf svc
mkdir svc

touch svc/down

cat > svc/run <<\EOF
#!/bin/sh

sleep 30
EOF
chmod +x svc/run

trap 'kill $SVC_' EXIT
../command/runsv ./svc &
SVC_=$!

../command/sv once ./svc
../command/sv status ./svc || echo .... Status $?
../command/svwaitup ./svc  || echo .... WaitUp $?

sleep 2
echo "Try again"

../command/sv status ./svc || echo .... Status $?
../command/svwaitup ./svc  || echo .... WaitUp $?




  reply	other threads:[~2009-07-19 17:14 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           ` Earl Chew [this message]
2009-07-24 20:31             ` svwaitup races with sv 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           ` sv sometimes won't issue down request Gerrit Pape
2009-07-27 17:39             ` 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=4A635477.6030503@agilent.com \
    --to=earl_chew@agilent.com \
    --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).