From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CvgCIRbET2BhbwAA0tVLHw (envelope-from ) for ; Mon, 15 Mar 2021 20:31:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id mBtsHBbET2DtTQAAbx9fmQ (envelope-from ) for ; Mon, 15 Mar 2021 20:31:18 +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 C2C97A68E for ; Mon, 15 Mar 2021 21:31:17 +0100 (CET) Received: from localhost ([::1]:45784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLtrw-0008BS-VR for larch@yhetil.org; Mon, 15 Mar 2021 16:31:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLtri-0008BF-FR for bug-guix@gnu.org; Mon, 15 Mar 2021 16:31:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLtri-0006Yt-7a for bug-guix@gnu.org; Mon, 15 Mar 2021 16:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLtri-0000DQ-34; Mon, 15 Mar 2021 16:31: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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 15 Mar 2021 20:31: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: Christopher Baines Received: via spool by 47157-submit@debbugs.gnu.org id=B47157.1615840227785 (code B ref 47157); Mon, 15 Mar 2021 20:31:02 +0000 Received: (at 47157) by debbugs.gnu.org; 15 Mar 2021 20:30:27 +0000 Received: from localhost ([127.0.0.1]:37302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLtr8-0000Cb-KR for submit@debbugs.gnu.org; Mon, 15 Mar 2021 16:30:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLtr6-0000CP-Jz for 47157@debbugs.gnu.org; Mon, 15 Mar 2021 16:30:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51567) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLtr1-0006Go-9b; Mon, 15 Mar 2021 16:30:19 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=46664 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lLtqy-00017f-Lw; Mon, 15 Mar 2021 16:30:18 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87eeggh4rh.fsf@inria.fr> <871rcgfiz9.fsf@cbaines.net> Date: Mon, 15 Mar 2021 21:30:15 +0100 In-Reply-To: <871rcgfiz9.fsf@cbaines.net> (Christopher Baines's message of "Mon, 15 Mar 2021 17:02:34 +0000") Message-ID: <87a6r4cg88.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=1615840277; 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: content-transfer-encoding:content-transfer-encoding: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=i3XaY75dUjbCWvpEO4PAKYq3vqCAEafxbqQjJe83tMA=; b=DponTdCo3Hj9e/yoCnZZq6bPE9od13U4fo2Z7bDvxGHza65JjyxY0jKTXZGF84l2dTWx2n 7WHpof2V3pZ5EjgYBOw61ugckNMWiA/NrbH4LyWmsJaq3MXVf4e0bHjA0XaQtVdZ7IYTTS 9YjTNttqoh8fObO2IS4ZtDgQOu92IsA66haNMM1S3ZXsFQsdOC6tEoi3m3F7jDic0DcaZ7 lREGUJ+1KVrfDbzZmZ9SKwhsd1mHAswOhlwK4kw4MUnJxQzq72koI0x8DIrweayfH4rXHU LjsG3qsCumA5l6nb7UvZETZJPH8CUIgd0uh/GNr7UYbhl2/K/YjGYduVAEYyRA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615840277; a=rsa-sha256; cv=none; b=X56ogZ43S6JiYJfgaGKz0Oh8iR9hfoZe+Z4GZr/TVViH1KmBq9AjT3WqU01uHhOiv/90U8 X6jw90no88sYpEqJS7Z617eP4qV3jAS+E2OjeAG5+ySXh7nHD35IXHXU8nwahVs0rX1fec Hqlu/wwTvobQavoa99CVEXeJcWtyWRZae1RBgmkJ29MkOIpz390iyErm0Ko/Kx0rmHI6yx u/gig0LEC5OC/TfIDPDaguybz+taFnAIpEFg/PfqmXtTb0dbWiueXmnq3kzjrGba0Oq+0C N2Axrba7Hz79ppXS0ySqhaTnpzFlDUT7AmFPTYkj3UL3izRjDm5GUssuleR+Xg== 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: -2.90 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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: C2C97A68E X-Spam-Score: -2.90 X-Migadu-Scanner: scn0.migadu.com X-TUID: ob3CqveekMOK Christopher Baines skribis: >> 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 t= hat 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=3Df50f5751fff4cf= c6d5abba9681054569694b7a5c > > 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 think that=E2=80=99s not enough because we can=E2=80=99t rely on the serv= er=E2=80=99s state intent here. For example, you have a keep-alive connection that you keep in cache. Minutes later, you come back and send a request over that port. If the server dropped the connection in the meantime, that can manifest in any of the ways we=E2=80=99ve seen: 'bad-response when attempting to read the response, some 'gnutls-error, 'system-error and EPIPE, etc. There=E2=80=99= s no way to determine in advance whether the socket is fine. That=E2=80=99s why the initial approach was to wrap all the call sites were= the socket was known to be possibly =E2=80=9Ctainted=E2=80=9D in =E2=80=98with-= cached-connection=E2=80=99. > I've now actually got around to testing this, I'm no expert at running > the substitute script manually without the guix-daemon, but I gave it a > go, using a local NGinx instance which just allowed two requests per > connection. I believe in this case =E2=80=98port-closed?=E2=80=99 returns true because = the socket/TLS record port got closed right at the end of the response, so it=E2=80=99s the =E2=80=9Ceasy=E2=80=9D case; I don=E2=80=99t think it capt= ures the situation I described above where an error comes up later while trying to write to/read from the port. Ludo=E2=80=99.