[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
19/20: http-client, substitute: Gracefully handle GnuTLS EAGAIN/EINTR.
From: |
guix-commits |
Subject: |
19/20: http-client, substitute: Gracefully handle GnuTLS EAGAIN/EINTR. |
Date: |
Sun, 25 Apr 2021 08:37:57 -0400 (EDT) |
civodul pushed a commit to branch version-1.3.0
in repository guix.
commit 69ffe875c38bde29eb420a819d74ddba916015bc
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Apr 24 17:59:14 2021 +0200
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.
---
guix/http-client.scm | 11 +++++++++--
guix/scripts/substitute.scm | 11 +++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/guix/http-client.scm b/guix/http-client.scm
index a2e11a1..bb1b0ee 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
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 48309f9..8e4eae0 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -45,7 +45,7 @@
#:select (uri-abbreviation nar-uri-abbreviation
(open-connection-for-uri
. guix:open-connection-for-uri)))
- #:autoload (gnutls) (error/invalid-session)
+ #:autoload (gnutls) (error/invalid-session error/again error/interrupted)
#:use-module (guix progress)
#:use-module ((guix build syscalls)
#:select (set-thread-name))
@@ -417,7 +417,14 @@ server certificates."
(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)))
(proc (open-connection-for-uri/cached uri
#:verify-certificate? #f
- 07/20: .gitignore: Ignore release artifacts., (continued)
- 07/20: .gitignore: Ignore release artifacts., guix-commits, 2021/04/25
- 04/20: .gitignore: Ignore generated .pot files., guix-commits, 2021/04/25
- 08/20: build: Add a check for Guile-Lib., guix-commits, 2021/04/25
- 16/20: po: Remove file that no longer exists., guix-commits, 2021/04/25
- 05/20: gnu: guile-git: Update to 0.5.1., guix-commits, 2021/04/25
- 09/20: import: go: Do not set '%strict-tokenizer?' from the top level., guix-commits, 2021/04/25
- 20/20: http-client: Remove exception mishandling in 'http-multiple-get'., guix-commits, 2021/04/25
- 10/20: import: go: Autoload (htmlprag)., guix-commits, 2021/04/25
- 11/20: file-systems: read-partition-{uuid, label} don't swallow ENOENT & co., guix-commits, 2021/04/25
- 17/20: cve: Gracefully handle bogus CVE entries., guix-commits, 2021/04/25
- 19/20: http-client, substitute: Gracefully handle GnuTLS EAGAIN/EINTR.,
guix-commits <=
- 18/20: doc: Fix cross-reference URL to translated manual., guix-commits, 2021/04/25
- 12/20: gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes]., guix-commits, 2021/04/25
- 14/20: guix-install.sh: Allow overriding the Guix binary source., guix-commits, 2021/04/25
- 13/20: gnu: wireshark: Update to 3.4.5 [security fixes]., guix-commits, 2021/04/25
- 15/20: import: Remove Nix importer., guix-commits, 2021/04/25