aboutsummaryrefslogtreecommitdiff
path: root/guix/http-client.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-04-24 17:59:14 +0200
committerLudovic Courtès <ludo@gnu.org>2021-04-24 19:08:13 +0200
commit02d62978f46fcc2793608bb57a2c20a30555dbba (patch)
tree40603c5ec83639d12b08c12055bff75a5fb1b0c1 /guix/http-client.scm
parent5dcc61a62f1052e123e092094714d5eed105e753 (diff)
downloadguix-02d62978f46fcc2793608bb57a2c20a30555dbba.tar
guix-02d62978f46fcc2793608bb57a2c20a30555dbba.tar.gz
http-client, substitute: Gracefully handle GnuTLS EAGAIN/EINTR.
Partly fixes <https://bugs.gnu.org/47867>. Reported by Florian Pelz <pelzflorian@pelzflorian.de>. In GnuTLS up to 3.7.1 included, GNUTLS_E_AGAIN and GNUTLS_E_INTERRUPTED are not handled by 'write_to_session_record_port' and could be thrown at the caller. This patch works around that by dropping connections altogether and restarting when this happens. * guix/http-client.scm (false-if-networking-error): Swallow ERROR/AGAIN and ERROR/INTERRUPTED. * guix/scripts/substitute.scm (call-with-cached-connection): Likewise.
Diffstat (limited to 'guix/http-client.scm')
-rw-r--r--guix/http-client.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/guix/http-client.scm b/guix/http-client.scm
index a2e11a1b73..bb1b0eeb56 100644
--- a/guix/http-client.scm
+++ b/guix/http-client.scm
@@ -38,7 +38,7 @@
#:use-module (guix utils)
#:use-module (guix base64)
#:autoload (gcrypt hash) (sha256)
- #:autoload (gnutls) (error/invalid-session)
+ #:autoload (gnutls) (error/invalid-session error/again error/interrupted)
#:use-module ((guix build utils)
#:select (mkdir-p dump-port))
#:use-module ((guix build download)
@@ -163,7 +163,14 @@ reusing stale cached connections."
(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 (first args)
+ (list error/invalid-session
+
+ ;; XXX: These two are not properly handled in
+ ;; GnuTLS < 3.7.2, in
+ ;; 'write_to_session_record_port'; see
+ ;; <https://bugs.gnu.org/47867>.
+ error/again error/interrupted)))
(memq key
'(bad-response bad-header bad-header-component)))
#f