Hi Ada,

Ada Stevenson <adansk...@gmail.com> skribis:

> Sometimes, usually when I'm on an enterprise network like my
> university's of library's wifi, the `guix substitute` process dies
> with a "TLS error in procedure 'write_to_session_record_port': Error
> in the push function" error message. My connection is rock-solid
> otherwise, and sometimes it doesn't happen at all.

What version of guix-daemon are you using?  Was it installed through
‘guix pull’ or via another distro?

I’ve seen this before but I haven’t experienced it in a long time, so I
wonder if I’m just lucky or if there are other factors at play.

> I'm not sure if this is a fault in the actual Guix code, or there's
> some Guile library somewhere that has this bug. Anyway, I think it
> would be a useful feature to have a way to automatically restart the
> `guix substitute` process or otherwise recover from this error. Some
> sort of `--restart=no.restarts.permitted` flag. Whenever I'm updating
> my system I tend to leave and do something else, and when this happens
> I come back and nothing's actually been done, and the error is
> transient so I don't gain anything from seeing this message.

‘guix substitute’ is a ‘guix-daemon’ helper, which automatically
(re)starts it when needed.

Now, what we could do is have ‘guix substitute’ gracefully handle those
errors and keep going.  I believe this one-liner should do it:

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 37cd08e289..3af0bf0019 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -494,7 +494,9 @@ (define* (download-nar narinfo destination
   (define (try-fetch choices)
     (match choices
       (((uri compression file-size) rest ...)
-       (guard (c ((and (pair? rest) (http-get-error? c))
+       (guard (c ((and (pair? rest)
+                       (or (http-get-error? c)
+                           (network-error? c)))
                   (warning (G_ "download from '~a' failed, trying next URL~%")
                            (uri->string uri))
                   (try-fetch rest)))
I’ll go ahead with this change if there are no objections.

Thanks,
Ludo’.

Reply via email to