GNU bug report logs -
#30637
[WIP] shepherd: Poll every 0.5s to find dead forked services
Previous Next
Full log
Message #38 received at 30637 <at> debbugs.gnu.org (full text, mbox):
Carlo Zancanaro <carlo <at> 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’.
This bug report was last modified 7 years and 133 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.