bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36380: service urandom-seed takes too long on boot


From: Ludovic Courtès
Subject: bug#36380: service urandom-seed takes too long on boot
Date: Thu, 11 Jul 2019 23:33:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hi Leo,

Leo Famulari <address@hidden> skribis:

> On Fri, Jun 28, 2019 at 01:24:01PM -0400, Leo Famulari wrote:
>> So, I suggest we add a 1 second timeout to this read.
>> 
>> I can work on that next week.
>
> I did try working on this, after reading the code in (guix scripts
> offload (call-with-timeout)).

The ‘start’ method of the ‘urandom-seed’ Shepherd service runs in PID 1,
so we certainly don’t want to fiddle with SIGALRM in that context, which
is what ‘call-with-timeout’ does.

Instead, I think we should use ‘select’ with a timeout:

  (call-with-input-file "/dev/hwrng"
    (lambda (port)
      (match (select (list port) '() '() 3)
        …)))

I think we can then use ‘get-bytevector-n!’, assuming it doesn’t block
if less than COUNT bytes are available (I’m not sure this is the case.)

HTH!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]