supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: "John O'Meara" <john.fr.omeara@gmail.com>
To: Laurent Bercot <ska-supervision@skarnet.org>
Cc: supervision@list.skarnet.org
Subject: Re: Generic interrupt command?
Date: Sat, 9 Feb 2019 23:14:20 -0500	[thread overview]
Message-ID: <CAPCpfp8QiQU_0nV2qw+kfNraww++F09yRAFfbJ=2ETi=8-6BAA@mail.gmail.com> (raw)
In-Reply-To: <emd84433ec-c077-4491-a2c7-7a9c821304ff@elzian>

[-- Attachment #1: Type: text/plain, Size: 1974 bytes --]

On Tue, Feb 5, 2019, 2:30 PM Laurent Bercot <ska-supervision@skarnet.org
wrote:

> >Not outputting anything causes kill (on my system at least) to exit non
> >0
>
>   Not outputting anything isn't an option, for the case where -o pid is
> used in addition to other fields. The field number and order must be
> respected.
>

Agreed; I didn't mean to suggest that as an option, I just wanted to be
thorough with testing.

  It's probably best to use some OOB indicator. How about NA, which I
> already use for non-numeric fields? it makes kill correctly choke.
> Would it be better to use NA in all the numeric fields, too?
>

That's a tough call. On the one hand, it makes simple constructs safer. On
the other, it adds complexity to interpreting the data programmatically (
the test / [ program errors for integer comparisons with text, and using
scanf() to pull in the values for libc style programs wouldn't be so simple
anymore).

Maybe adding a flag like -n as an output modifier to keep the relevant
output numeric when wanted? Then the default could be NA. Of course, that
adds complexity to the svstat program, it's interface and documentation. It
is also incompatible with existing programs that may be using svstat
already, requiring the flag for new versions of svstat and not the flag for
old versions.

Also, while thinking about this, I wonder the risk of signaling the wrong
program. When svc does it via supervise, it can know the right program gets
the signal because it handles the cleaning of the child PID. In a script,
there is a chance the child has exited and been replaced between the time
the PID was queried by svstat and the time the kill command gets executed.
I don't know how likely a new program might get the old PID in that time,
this receiving the signal intended for the original child. I think itis a
low number, but not zero. This line of thinking unfortunately brings us
back to the original post in this thread :-(

-- 
John O'Meara

>

  reply	other threads:[~2019-02-10  4:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02  2:36 Steve Litt
2019-02-02  9:07 ` Laurent Bercot
2019-02-02 19:30   ` Steve Litt
2019-02-02 21:08     ` Colin Booth
2019-02-02 21:40       ` Steve Litt
2019-02-05  3:09         ` John O'Meara
2019-02-05  4:15           ` Roger Pate
2019-02-05  7:20           ` Laurent Bercot
2019-02-05 14:16             ` John O'Meara
2019-02-05 19:30               ` Laurent Bercot
2019-02-10  4:14                 ` John O'Meara [this message]
2019-02-10 11:41                   ` Laurent Bercot
2019-02-02 22:31       ` Jonathan de Boyne Pollard

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='CAPCpfp8QiQU_0nV2qw+kfNraww++F09yRAFfbJ=2ETi=8-6BAA@mail.gmail.com' \
    --to=john.fr.omeara@gmail.com \
    --cc=ska-supervision@skarnet.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).