From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#36380: service urandom-seed takes too long on boot Date: Thu, 11 Jul 2019 23:33:07 +0200 Message-ID: <87k1contnw.fsf@gnu.org> References: <20190626154721.GA2999@jasmine.lan> <87zhm3xdfu.fsf@gnu.org> <20190627190314.GA7403@jasmine.lan> <20190628172401.GA17073@jasmine.lan> <20190711174455.GA30457@jasmine.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52933) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlghX-0007Cm-Lg for bug-guix@gnu.org; Thu, 11 Jul 2019 17:34:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlghW-0006Px-OM for bug-guix@gnu.org; Thu, 11 Jul 2019 17:34:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58345) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hlghW-0006Pm-Ks for bug-guix@gnu.org; Thu, 11 Jul 2019 17:34:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hlghW-0002YG-Ef for bug-guix@gnu.org; Thu, 11 Jul 2019 17:34:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20190711174455.GA30457@jasmine.lan> (Leo Famulari's message of "Thu, 11 Jul 2019 13:44:55 -0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Leo Famulari Cc: 36380@debbugs.gnu.org, Robert Vollmert Hi Leo, Leo Famulari 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. >>=20 >> 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 =E2=80=98start=E2=80=99 method of the =E2=80=98urandom-seed=E2=80=99 Sh= epherd service runs in PID=C2=A01, so we certainly don=E2=80=99t want to fiddle with SIGALRM in that context, = which is what =E2=80=98call-with-timeout=E2=80=99 does. Instead, I think we should use =E2=80=98select=E2=80=99 with a timeout: (call-with-input-file "/dev/hwrng" (lambda (port) (match (select (list port) '() '() 3) =E2=80=A6))) I think we can then use =E2=80=98get-bytevector-n!=E2=80=99, assuming it do= esn=E2=80=99t block if less than COUNT bytes are available (I=E2=80=99m not sure this is the ca= se.) HTH! Ludo=E2=80=99.