From: ludo@gnu.org (Ludovic Courtès)
To: Carlo Zancanaro <carlo@zancanaro.id.au>
Cc: 30637@debbugs.gnu.org
Subject: [bug#30637] [WIP] shepherd: Poll every 0.5s to find dead forked services
Date: Sun, 04 Mar 2018 23:49:06 +0100 [thread overview]
Message-ID: <87o9k33199.fsf@gnu.org> (raw)
In-Reply-To: <871sgzpiy9.fsf@zancanaro.id.au> (Carlo Zancanaro's message of "Mon, 05 Mar 2018 09:35:58 +1100")
Carlo Zancanaro <carlo@zancanaro.id.au> skribis:
> On Sun, Mar 04 2018, Ludovic Courtès wrote:
>> Good catch. We could add this in gnu-build-system.scm in
>> core-updates, though it’s no big deal anyway since these are
>> throw-away environments.
>>
>> Thoughts?
>
> The current forking-service.sh test fails in that environment, so we
> won't be able to build shepherd on Hurd, or systems with Linux pre
> 3.4. This is already the case without my third commit, though, because
> the prctl fallback logic isn't in place yet.
>
> I think we should add it in core-updates. It does affect the behaviour
> of processes within the build environment, and can lead to test
> failures if people rely on pid 1 to reap zombie processes (which, from
> what I understand, they should be able to). This could even be leading
> to test failures in other packages which we have just disabled.
Yeah, makes sense.
>>> + (match (select (list sock) (list) (list) 0.5)
>>> + (((sock) _ _)
>>> + (read-from sock))
>>> + (_
>>> + #f))
>>> + (poll-services)
>>
>> Here everyone ends up paying some overhead (the 0.5 second timeout),
>> which isn’t great.
>>
>> How about something like:
>>
>> (define poll-services
>> (and (not (= 1 (getpid)))
>> …))
>>
>> (match (select (list sock) '() '() (if poll-services 0.5 0))
>> …)
>
> The wait for 0.5 seconds is only an upper-bound for the
> timeout. Changing it to a 0 would actually be worse, because it would
> spend longer polling for running services. The `select` procedure
> waits for `sock` to be ready to read from. When it's ready it returns
> immediately, but if `sock` takes more than 0.5 seconds to be ready
> then it will return anyway (and take the second branch in the match,
> which does nothing).
Sorry, I didn’t mean 0 but rather #f (indefinite wait).
My point is: we shouldn’t wake up every 0.5 seconds for no reason. IOW,
we should wake up periodically only in the non-pid-1-no-prctl case.
Does that make sense?
Ludo’.
next prev parent reply other threads:[~2018-03-04 22:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 21:56 [bug#30637] [WIP] shepherd: Poll every 0.5s to find dead forked services Carlo Zancanaro
2018-02-28 22:06 ` Ludovic Courtès
2018-03-01 22:37 ` Carlo Zancanaro
2018-03-02 9:44 ` Ludovic Courtès
2018-03-02 10:13 ` Carlo Zancanaro
2018-03-02 12:42 ` Ludovic Courtès
2018-03-03 7:58 ` Carlo Zancanaro
2018-03-03 15:21 ` Ludovic Courtès
2018-03-03 20:49 ` Carlo Zancanaro
2018-03-04 22:11 ` Ludovic Courtès
2018-03-04 22:35 ` Carlo Zancanaro
2018-03-04 22:49 ` Ludovic Courtès [this message]
2018-03-04 23:08 ` Carlo Zancanaro
2018-03-05 14:15 ` bug#30637: " Ludovic Courtès
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=87o9k33199.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=30637@debbugs.gnu.org \
--cc=carlo@zancanaro.id.au \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.