From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?G=C3=A1bor?= Boskovits Subject: bug#35631: shepherd: dies on invalid code Date: Wed, 8 May 2019 13:49:32 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f615e205885eed59" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:43475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOL5I-00067k-RV for bug-guix@gnu.org; Wed, 08 May 2019 07:50:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOL5G-0006ey-SB for bug-guix@gnu.org; Wed, 08 May 2019 07:50:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46953) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOL5G-0006eu-PQ for bug-guix@gnu.org; Wed, 08 May 2019 07:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hOL5G-00085y-Mw for bug-guix@gnu.org; Wed, 08 May 2019 07:50:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:43440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOL51-00067X-Sx for bug-guix@gnu.org; Wed, 08 May 2019 07:49:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOL50-0006aT-J1 for bug-guix@gnu.org; Wed, 08 May 2019 07:49:47 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:36254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOL50-0006Zx-8Y for bug-guix@gnu.org; Wed, 08 May 2019 07:49:46 -0400 Received: by mail-ed1-x530.google.com with SMTP id a8so21808186edx.3 for ; Wed, 08 May 2019 04:49:45 -0700 (PDT) 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: 35631@debbugs.gnu.org --000000000000f615e205885eed59 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Observed behaviour: Shepherd dies on loading invalid code. Expected behaviour: Send an error message to the log and back to the herd, that the given service could not be loaded. (Maybe a more detailed one, that helps in debugging). Continue operation without the offending service. Steps to reproduce: shepherd -s ~/shepherd.sock -c ok-service.scm & and then herd -s ~/shepherd.sock load root failing-service.scm results in the following backtrace: Backtrace: 15 (primitive-load "/root/.guix-profile/bin/shepherd") In shepherd.scm: 270:10 14 (main . _) 58:17 13 (call-with-server-socket "/root/shepherd.sock" _) 288:20 12 (_ #) In ice-9/boot-9.scm: 829:9 11 (catch system-error # =E2=80=A6) In shepherd.scm: 325:9 10 (_) In ice-9/boot-9.scm: 829:9 9 (catch quit # =E2=80=A6) In shepherd.scm: 378:11 8 (_) 380:50 7 (_ _ #) In shepherd/service.scm: 270:14 6 (condition->sexp #) In srfi/srfi-1.scm: 592:29 5 (map1 (#f "definition in expression context, where d=E2=80=A6"= =E2=80=A6)) 592:29 4 (map1 ("definition in expression context, where defi=E2=80=A6"= =E2=80=A6)) 592:17 3 (map1 (((line . 2) (column . 40) (filename . "fai=E2=80=A6")) = =E2=80=A6)) 592:17 2 (map1 ((line . 2) (column . 40) (filename . "failing=E2=80=A6"= ))) 589:5 1 (map #< result->sexp (8)> (line . 2)) In unknown file: 0 (scm-error wrong-type-arg "map" "Wrong type argument: =E2=80= =A6" =E2=80=A6) ERROR: In procedure scm-error: In procedure map: Wrong type argument: (line . 2) herd: premature end-of-file while talking to shepherd and shepherd dies: [1]+ Kil=C3=A9pett(1) shepherd -s ~/shepherd.sock -c ok-service= .scm at the end of ps ax output. The only relevant line in the logs is: May 8 13:35:46 localhost shepherd[365]: Loading failing-service.scm. This causes serious problems when shepherd is running as pid1. The content of the configuration files: ok-service.scm: (register-services (make #:provides '(ok-service) #:start ((const #t)))) failing-service.scm: (register-services (make #:provides '(failing-service) #:start ((const #t)(define x 1)))) --000000000000f615e205885eed59 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Obse= rved behaviour:
Shepherd dies on loading invalid code.
<= div>
Expected behaviour:
Send an error message to t= he log and=20 back to the herd, that the given service could not be loaded. (Maybe a=20 more detailed one, that helps in debugging).
Continue operation w= ithout the offending service.

Steps to repro= duce:
shepherd -s ~/shepherd.sock -c ok-service.scm &

and then

herd -s ~/shepherd.sock= load root failing-service.scm

results in the foll= owing backtrace:
Backtrace:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 15 (primitive-load "/root/.guix-profile/bin/shep= herd")
In shepherd.scm:
=C2=A0=C2=A0 270:10 14 (main . _)
=C2= =A0=C2=A0=C2=A0 58:17 13 (call-with-server-socket "/root/shepherd.sock= " _)
=C2=A0=C2=A0 288:20 12 (_ #<input-output: socket 15>)In ice-9/boot-9.scm:
=C2=A0=C2=A0=C2=A0 829:9 11 (catch system-error #&= lt;procedure 17fe9c0 at shepherd.sc=E2= =80=A6> =E2=80=A6)
In shepherd.scm:
=C2=A0=C2=A0=C2=A0 325:9 10 (_= )
In ice-9/boot-9.scm:
=C2=A0=C2=A0=C2=A0 829:9=C2=A0 9 (catch quit #= <procedure 191e100 at shepherd.scm:357:7 =E2=80=A6> =E2=80=A6)
In = shepherd.scm:
=C2=A0=C2=A0 378:11=C2=A0 8 (_)
=C2=A0=C2=A0 380:50=C2= =A0 7 (_ _ #<condition &action-runtime-error [service: #<<ser= =E2=80=A6>)
In shepherd/service.scm:
=C2=A0=C2=A0 270:14=C2=A0 6 (= condition->sexp #<condition &action-runtime-error [ser=E2=80=A6&g= t;)
In srfi/srfi-1.scm:
=C2=A0=C2=A0 592:29=C2=A0 5 (map1 (#f "d= efinition in expression context, where d=E2=80=A6" =E2=80=A6))
=C2= =A0=C2=A0 592:29=C2=A0 4 (map1 ("definition in expression context, whe= re defi=E2=80=A6" =E2=80=A6))
=C2=A0=C2=A0 592:17=C2=A0 3 (map1 (((= line . 2) (column . 40) (filename . "fai=E2=80=A6")) =E2=80=A6))<= br>=C2=A0=C2=A0 592:17=C2=A0 2 (map1 ((line . 2) (column . 40) (filename . = "failing=E2=80=A6")))
=C2=A0=C2=A0=C2=A0 589:5=C2=A0 1 (map #&= lt;<generic> result->sexp (8)> (line . 2))
In unknown file:<= br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0 (scm-erro= r wrong-type-arg "map" "Wrong type argument: =E2=80=A6"= =E2=80=A6)

ERROR: In procedure scm-error:
In procedure map: Wron= g type argument: (line . 2)
herd: premature end-of-file while talking to= shepherd

and shepherd dies:
[1]+=C2= =A0 Kil=C3=A9pett(1)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 shepherd -s ~/shepherd.sock -c ok-service.scm
at= the end of ps ax output.

The only relevant line i= n the logs is:
May=C2=A0 8 13:35:46 localhost shepherd[365]: Load= ing failing-service.scm.

This causes serious probl= ems when shepherd is running as pid1.

The content = of the configuration files:
ok-service.scm:
(register-s= ervices (make <service>
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0 #:provides '(ok-service)
=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 #:start ((const #t))))
failing-service.scm:
(register-services (make <service&g= t;
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 #:prov= ides '(failing-service)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0=C2=A0 #:start ((const #t)(define x 1))))
--000000000000f615e205885eed59--