From: "Ludovic Courtès" <ludo@gnu.org>
To: 71144@debbugs.gnu.org
Cc: Andreas Enge <andreas@enge.fr>, Christopher Baines <mail@cbaines.net>
Subject: bug#71144: Interactive prompt opened upon shepherd config file error
Date: Sat, 25 May 2024 11:11:04 +0200 [thread overview]
Message-ID: <878qzy45p3.fsf@gnu.org> (raw)
In-Reply-To: <87sey894kj.fsf@inria.fr> ("Ludovic Courtès"'s message of "Thu, 23 May 2024 12:59:40 +0200")
[-- Attachment #1: Type: text/plain, Size: 2596 bytes --]
Ludovic Courtès <ludovic.courtes@inria.fr> skribis:
> I think we should change the above to log and gracefully handle failure
> to load an individual service file.
With the change below, every service except the offending one is loaded
and started as expected:
--8<---------------cut here---------------start------------->8---
[ 22.450515] shepherd[1]: Service root running with value #t.
[ 22.454624] shepherd[1]: Service root has been started.
[ 22.711738] shepherd[1]: Exception caught while loading '/gnu/store/fjis6iqpjfcnr90fy8rsg9v4j828jslv-shepherd-gwl-web.go': #<&compound-exception components: (#<&undefined-variable> #<&origin origin: #f> #<&message message: "Unbound variable: ~S"> #<&irritants irri
[ 22.711839] tants: (make-forkexec-constructor/container)> #<&exception-with-kind-and-args kind: unbound-variable args: (#f "Unbound variable: ~S" (make-forkexec-constructor/container) #f)>)>
[ 22.755146] shepherd[1]: starting services...
[ 22.756491] shepherd[1]: Configuration successfully loaded from '/gnu/store/mq7y31xnjcjwjkyf6w7qiaq61g6n9f5x-shepherd.conf'.
Uncaught exception in task:
In fibers.scm:
172:8 7 (_)
In ice-9/exceptions.scm:
406:15 6 (_)
In ice-9/boot-9.scm:
1752:10 5 (with-exception-handler _ _ #:unwind? _ # _)
In shepherd/service.scm:
824:39 4 (_)
In oop/goops.scm:
1567:11 3 (cache-miss #f)
1585:2 2 (_ _ _)
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1683:16 0 (raise-exception _ #:continuable? _)
ice-9/boot-9.scm:1683:16: In procedure raise-exception:
No applicable method for #<<generic> one-shot-service? (1)> in call (one-shot-service? #f)
[ 22.798737] shepherd[1]: Starting service user-file-systems...
[ 22.800361] shepherd[1]: Starting service root-file-system...
[ 22.802015] shepherd[1]: Starting service host-name...
[ 22.803688] shepherd[1]: Starting service pam...
[ 22.805372] shepherd[1]: Starting service sysctl...
[ 22.806926] shepherd[1]: Starting service loopback...
[ 22.808225] shepherd[1]: Starting service firewall...
--8<---------------cut here---------------end--------------->8---
(There’s still this scary-looking but harmless backtrace in the middle:
that’s because (start-in-the-background '(something-that-does-not-exist))
throws like that as of 0.10.4.)
Once booted, shepherd is fine and you can interact normally with it; the
only thing missing is, in this case, the ‘gwl-web’ service, which we
failed to load.
I think that’s a significant improvement.
Thoughts?
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2153 bytes --]
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 455e972535d..f13c52c37ba 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -380,8 +380,7 @@ (define (shepherd-configuration-file services shepherd)
(scm->go (cute scm->go <> shepherd)))
(define config
#~(begin
- (use-modules (srfi srfi-34)
- (system repl error-handling))
+ (use-modules (srfi srfi-1))
(define (make-user-module)
;; Copied from (shepherd support), where it's private.
@@ -417,17 +416,22 @@ (define (shepherd-configuration-file services shepherd)
;; Arrange to spawn a REPL if something goes wrong. This is better
;; than a kernel panic.
- (call-with-error-handling
- (lambda ()
- (register-services
- (parameterize ((current-warning-port
- (%make-void-port "w")))
- (map (lambda (file)
- (save-module-excursion
- (lambda ()
- (set-current-module (make-user-module))
- (load-compiled file))))
- '#$(map scm->go files))))))
+ (register-services
+ (parameterize ((current-warning-port (%make-void-port "w")))
+ (filter-map (lambda (file)
+ (with-exception-handler
+ (lambda (exception)
+ (format #t "Exception caught \
+while loading '~a': ~s~%"
+ file exception)
+ #f)
+ (lambda ()
+ (save-module-excursion
+ (lambda ()
+ (set-current-module (make-user-module))
+ (load-compiled file))))
+ #:unwind? #t))
+ '#$(map scm->go files))))
(format #t "starting services...~%")
(let ((services-to-start
next prev parent reply other threads:[~2024-05-25 9:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 10:59 bug#71144: Interactive prompt opened upon shepherd config file error Ludovic Courtès
2024-05-25 9:11 ` Ludovic Courtès [this message]
2024-05-25 12:02 ` Christopher Baines
2024-05-25 14:59 ` 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=878qzy45p3.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=71144@debbugs.gnu.org \
--cc=andreas@enge.fr \
--cc=mail@cbaines.net \
/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.