guix-patches
[Top][All Lists]
Advanced

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

[bug#45323] [PATCH] substitute: Reuse connections for '--query'.


From: Ludovic Courtès
Subject: [bug#45323] [PATCH] substitute: Reuse connections for '--query'.
Date: Sun, 27 Dec 2020 15:57:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi!

Christopher Baines <mail@cbaines.net> skribis:

> The Guix Build Coordinator uses code from this script, and I'm sometimes
> seeing exceptions like [1] when running with these changes. This is when
> calling lookup-narinfos.
>
> 1:
> #<&compound-exception components: (#<&error> #<&irritants irritants: 
> (#<gnutls-error-enum The specified session has been invalidated for some
> reason.> write_to_session_record_port)> #<&exception-with-kind-and-args kind: 
> gnutls-error args: (#<gnutls-error-enum The specified session hasbeen 
> invalidated for some reason.> write_to_session_record_port)>)>,
>
> When this happens, things seem to get stuck and retrying calling
> lookup-narinfos leads to the same exception. I'm guessing this might be
> happening because the broken connection is being cached and reused.

Ah, that looks like another thing that might break.  Does the patch
below help?

Thanks for reporting it,
Ludo’.

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 8084c89ae5..e53de8c304 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -43,6 +43,7 @@
                           (open-connection-for-uri
                            . guix:open-connection-for-uri)
                           store-path-abbreviation byte-count->string))
+  #:autoload   (gnutls) (error/invalid-session)
   #:use-module (guix progress)
   #:use-module ((guix build syscalls)
                 #:select (set-thread-name))
@@ -1054,9 +1055,12 @@ server certificates."
         ;; If PORT was cached and the server closed the connection in the
         ;; meantime, we get EPIPE.  In that case, open a fresh connection and
         ;; retry.  We might also get 'bad-response or a similar exception from
-        ;; (web response) later on, once we've sent the request.
+        ;; (web response) later on, once we've sent the request, or a
+        ;; ERROR/INVALID-SESSION from GnuTLS.
         (if (or (and (eq? key 'system-error)
                      (= EPIPE (system-error-errno `(,key ,@args))))
+                (and (eq? key 'gnutls-error)
+                     (eq? (first args) error/invalid-session))
                 (memq key '(bad-response bad-header bad-header-component)))
             (proc (open-connection uri #:fresh? #t))
             (apply throw key args))))))

reply via email to

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