From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8BuvHEqUT2BqfwAA0tVLHw (envelope-from ) for ; Mon, 15 Mar 2021 17:07:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gDhrGEqUT2DpPAAAB5/wlQ (envelope-from ) for ; Mon, 15 Mar 2021 17:07:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C8D718AB8 for ; Mon, 15 Mar 2021 18:07:21 +0100 (CET) Received: from localhost ([::1]:36924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLqga-0002JW-Us for larch@yhetil.org; Mon, 15 Mar 2021 13:07:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLqcQ-00009j-V3 for bug-guix@gnu.org; Mon, 15 Mar 2021 13:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53344) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLqcQ-0000uP-LW for bug-guix@gnu.org; Mon, 15 Mar 2021 13:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLqcQ-0000e8-HO; Mon, 15 Mar 2021 13:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#47157: =?UTF-8?Q?=E2=80=9CBad?= Read-Header-Line header: =?UTF-8?Q?#=E2=80=9D?= while substituting Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 15 Mar 2021 17:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47157 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 47157-submit@debbugs.gnu.org id=B47157.16158277602450 (code B ref 47157); Mon, 15 Mar 2021 17:03:02 +0000 Received: (at 47157) by debbugs.gnu.org; 15 Mar 2021 17:02:40 +0000 Received: from localhost ([127.0.0.1]:36657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLqc3-0000dR-W2 for submit@debbugs.gnu.org; Mon, 15 Mar 2021 13:02:40 -0400 Received: from mira.cbaines.net ([212.71.252.8]:33530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLqc2-0000dJ-5o for 47157@debbugs.gnu.org; Mon, 15 Mar 2021 13:02:38 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 5AC1327BC52; Mon, 15 Mar 2021 17:02:37 +0000 (GMT) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 7cf3fda7; Mon, 15 Mar 2021 17:02:36 +0000 (UTC) References: <87eeggh4rh.fsf@inria.fr> User-agent: mu4e 1.4.15; emacs 27.1 From: Christopher Baines In-reply-to: <87eeggh4rh.fsf@inria.fr> Date: Mon, 15 Mar 2021 17:02:34 +0000 Message-ID: <871rcgfiz9.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 47157@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615828041; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=L/RCYi4n6xfqLoANGKDcJakDVc4ed03ZMCsfdw2ffYI=; b=UPx1EHWyXshhgvkRjMdMmQ7prvivsC6Rvh/0OXnQ2q3OSoRa7IPCq5D+f6cWYcMMj4tscr 2dPzh/ALRIeQ0AaVVqn7z//ttHBWr8c1eW2c451ojIv6lrGlAPiQ4h/BUTFdvZqN0sgmSi /EbtVsExJen9EWpUaTi9TpD2IjFqPB4jG7Gqw/G/Anc6wmzVqjXiQwb3Sk+oP29LWOWkpp 2yn21A3jMbAxRbkzVpycbla9587OEoVtNEGowN+l0A8+Z1nVxDpTY+eVH2IRksjAu4IdsX 4flK1aNaQRDAetP/RrXbtAFprHIpc8R8ACDtChWGSAoWIwspmJEabsVwWqwfag== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615828041; a=rsa-sha256; cv=none; b=mjzS0BKpVYiplPZVeR1RzGHb8T3fHK2O0NNsFYdW8kHtrVIAJV2mBxd1HnXTaKXyBt9+S8 vEluzjzucXkKER+1uotwIWgcoafpFbN6e75kgs9UwJ+AN9cEqCWD91Y5rqxiD9cU8sKdvk P6Zk0z4fwCbl4L8LgF5xLnHTP8+OVClllVd4S6UzJe8ysP2sd3PmkfZ/MXmNzxJU9LaAYC tro2j68DEm5hg5jJ11nmuxAFQqdGzeO79T3JUQ8Cvh97Z74iJt2o4d5qJxeHjd1DFfUBxO 7kPFvLA1hLE8wvj3SO3OOMEyrdlyYFgLONKkkpB3WxlR38kIkmgnQIUSC09nBg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -4.50 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: C8D718AB8 X-Spam-Score: -4.50 X-Migadu-Scanner: scn0.migadu.com X-TUID: OdsgW+C2w4UX --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > As reported by a few people on IRC, =E2=80=98guix substitute=E2=80=99 som= etimes fails in > a way that I just experienced (from > 8154beffd8c121e953a7c4cd75c3eebfcc073a9a): > > --8<---------------cut here---------------start------------->8--- > downloading from https://ci.guix.gnu.org/nar/gzip/0bji0q5n59595xaqkqrp2gv= 52lbz55xz-libpng-1.6.37 . > libpng-1.6.37 275KiB 11.0MiB/s 00:00 [#= #################] 100.0% > > downloading from https://ci.guix.gnu.org/nar/lzip/h3a5ygxxh4gakhnl53mq7z9= b43l8z05g-python-minimal. > python-minimal-wrapper-3.8.2 351B 293KiB/s 00:00 [#= #################] 100.0% > > downloading from https://ci.guix.gnu.org/nar/lzip/h8j09yb5d8dh3jffvpzawxs= lig9bwhdr-freetype-2.10.. > freetype-2.10.4 600KiB 3.0MiB/s 00:00 [#= #################] 100.0% > > building /gnu/store/2wfzazqz9g5xizi4vq4pv75nkh1m24bp-perl-5.30.2.drv... > Backtrace: > In guix/ui.scm: > 2164:12 19 (run-guix-command _ . _) > In guix/scripts/substitute.scm: > 691:2 18 (guix-substitute . _) > In unknown file: > 17 (with-continuation-barrier #) > In ice-9/boot-9.scm: > 1736:10 16 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) > In unknown file: > 15 (apply-smob/0 #) > In ice-9/boot-9.scm: > 1736:10 14 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) > 1736:10 13 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) > 1731:15 12 (with-exception-handler # _) > In guix/scripts/substitute.scm: > 740:17 11 (_) > 434:7 10 (process-substitution _ "/gnu/store/ns00dyapjbq9037dwrxa7hc3= 1dvir00n-grub-minimal-2.) > In ice-9/boot-9.scm: > 1736:10 9 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) > In guix/scripts/substitute.scm: > 443:9 8 (_) > In ice-9/boot-9.scm: > 1731:15 7 (with-exception-handler # _) > 1669:16 6 (raise-exception _ #:continuable? _) > 1667:16 5 (raise-exception _ #:continuable? _) > 1669:16 4 (raise-exception _ #:continuable? _) > 1764:13 3 (_ #<&compound-exception components: (#<&error> #<&irritants= irritants: (read-header) > 1669:16 2 (raise-exception _ #:continuable? _) > 1667:16 1 (raise-exception _ #:continuable? _) > 1669:16 0 (raise-exception _ #:continuable? _) > > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > Bad Read-Header-Line header: # > --8<---------------cut here---------------end--------------->8--- > > This is the kind of issue that =E2=80=98with-cached-connection=E2=80=99 a= s it can be > seen in 9158020d7853b6e7925802e0d0a082801c680e8f avoided: > > --8<---------------cut here---------------start------------->8--- > (define* (call-with-cached-connection uri proc > #:optional > (open-connection > open-connection-for-uri/cached)) > (let ((port (open-connection uri))) > (catch #t > (lambda () > (proc port)) > (lambda (key . args) > ;; 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, or a > ;; ERROR/INVALID-SESSION from GnuTLS. > (if (or (and (eq? key 'system-error) > (=3D 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)))))) > --8<---------------cut here---------------end--------------->8--- > > I think 7b812f7c84c43455cdd68a0e51b6ded018afcc8e and subsequent commits > may have caused this regression. In particular, in > 20c08a8a45d0f137ead7c05e720456b2aea44402, > =E2=80=98call-with-connection-error-handling=E2=80=99 is now used, but th= at one doesn=E2=80=99t > catch the exceptions mentioned above, in this case =E2=80=98bad-header=E2= =80=99. I think the behaviour changed unintentionally with [1], however, thinking about the connection reuse in process-substitution compared with http-multiple-get, there's no attempt here to look at if the server has specified whether the connection should be closed. 1: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3Df50f5751fff4cfc6= d5abba9681054569694b7a5c Just like http-multiple-get, it's probably worth trying to check the headers of the response, look at whether the server has indicated that the connection should be closed, and if so, close the connection, forcing a new one to be established for future requests. I haven't tested this theory, but maybe if that happened, then some occurrences of trying to read a response, and not being able to would be prevented. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmBPkypfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XcL/hAAlXF3sB5OW9jZtO5eGKwDnRqIxQfmSDXa WNEDujhBYdKQCy8rsab5FBhE2A4WoTpHCbDWrRH/eXlPTCSd1Z+FO80zsShvD7O5 qtM4vBXZsOCI5Fze+jUEx5P7MCDiszOQ3BSfR2yp43TAD33c6W/Ax20uXklDuSff 4CQXNUnYtwItAB1i+LYO1Cde1jIXcUwwx9QJZY77HMaWqdvOkMaLWXYPA/eR/D9k 34Er/E0AFbuoLKj0keVs52pVfgwEvVcL5RZDiU9hEB3vPEAyFrnjwY1kjv55UmZl Uehu21hK4HVBzuaaJCNENAdUjzYkuaMlMAgjmHMFv2uyBGChq6EIje2XsNN/NGs1 gpiC0naNCWxit1FhnymQxfcxlSwnE1WbNLEGulaR4k0BJwC+K4jLW/yuo9iFF64g U7DKxgqeqCXkWID9V6jkoxd3/N0zsrdoqPPx7/n4wHwRpSP/8bJwp5/NHtTmSN42 d5OAqOL8dJzBOmxOqkrqJAuiO9AX3IGwnT0fa38mTH0zGemfkHSB+7UFUhET4eRv eKz7QIvZeDeCpSRJ485qBbdgdZrr4gEoh5TaM5eZJdiEjrOub1cJVf80OtAn+75Y biJ0O/AxTZg6Ya7bYO/TcZbIzNE6gSTLmLX20f01AjGVXpPklCXmStDTEyMyaDtW OzLyw1b6q1w= =w5/u -----END PGP SIGNATURE----- --=-=-=--