GNU bug report logs - #26489
[PATCH] substitute: Ignore bad responses.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Tobias Geerinckx-Rice <me@HIDDEN>; Keywords: patch; dated Fri, 14 Apr 2017 00:28:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 26489 <at> debbugs.gnu.org:


Received: (at 26489) by debbugs.gnu.org; 1 May 2017 13:14:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 01 09:14:58 2017
Received: from localhost ([127.0.0.1]:48631 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d5BAI-000416-HN
	for submit <at> debbugs.gnu.org; Mon, 01 May 2017 09:14:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42866)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1d5BAH-00040u-7N
 for 26489 <at> debbugs.gnu.org; Mon, 01 May 2017 09:14:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <ludo@HIDDEN>) id 1d5BA8-00049o-Lv
 for 26489 <at> debbugs.gnu.org; Mon, 01 May 2017 09:14:51 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40286)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1d5BA8-00049k-IP; Mon, 01 May 2017 09:14:48 -0400
Received: from reverse-83.fdn.fr ([80.67.176.83]:58358 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1d5BA7-0001j7-Vv; Mon, 01 May 2017 09:14:48 -0400
From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=)
To: Tobias Geerinckx-Rice <me@HIDDEN>
Subject: Re: bug#26489: [PATCH] substitute: Ignore bad responses.
References: <20170414002755.32672-1-me@HIDDEN> <87lgr3gvqf.fsf@HIDDEN>
 <ca4baf38-3b11-1c8a-a7b1-167f6500c247@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 12 =?utf-8?Q?Flor=C3=A9al?= an 225 de la =?utf-8?Q?R?=
 =?utf-8?Q?=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-unknown-linux-gnu
Date: Mon, 01 May 2017 15:14:44 +0200
In-Reply-To: <ca4baf38-3b11-1c8a-a7b1-167f6500c247@HIDDEN> (Tobias
 Geerinckx-Rice's message of "Fri, 28 Apr 2017 22:56:34 +0200")
Message-ID: <87o9vc3eij.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 26489
Cc: 26489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hi!

Tobias Geerinckx-Rice <me@HIDDEN> skribis:

> On 14/04/17 11:54, Ludovic Court=C3=A8s wrote:
>> Tobias Geerinckx-Rice <me@HIDDEN> skribis:
>>> One weird HTTP response from a server will kill =E2=80=98guix substitut=
e=E2=80=99:
>>>=20
>>> updating list of substitutes from 'https://foo'... 50.0%Backtrace:
>>>  ... guix/ui.scm:1229:8: In procedure run-guix-command:=20
>>> guix/ui.scm:1229:8: Throw to key `bad-response' with args `("Bad=20
>>> Response-Line: ~s" (""))'. error: build failed: substituter=20
>>> `substitute' died unexpectedly
>>>=20
>>> Attached is a patch to ignore such bad responses. The offending=20
>>> .narinfo will be ignored for that session, and not cached at all.=20
>>> The result:
>>=20
>> I=E2=80=99m sure you expect this question: what bad responses did you ge=
t in=20
>> practice?  :-)
>
> In fact, not really. The error message looked unambiguous to me: the
> HTTP response (the first line returned to the client, e.g. "HTTP/1.1 200
> OK") was simply empty, throwing an exception.
>
> Interestingly, a newline seems to be required.
>
> Using http://bad.http.response.tobias.gr as a substitute server triggers
> it. http://no.http.response.tobias.gr does not.
>
>> Usually that is a sign of a broken HTTP server.
>
> I think it's actually something in-between me and the server. I'll take
> a closer look next time this happens.
>
>> Of course it=E2=80=99s  widespread enough, we=E2=80=99d better handle it=
, either in=20
>> Guix or directly in (web client) in Guile;
>
> As I read it, (web client) considers throwing a BAD-RESPONSE exception
> the best or only way to deal with an error like this. I agree.
>
>> OTOH, if it=E2=80=99s a genuine problem, we=E2=80=99d better not hide it.
>
> Well, we don't hide it, per se. Hence the error message.
>
> I think throwing an unhandled exception is definitely the wrong thing to
> do here =E2=80=94 this kills even =E2=80=98guix --keep-going --fallback=
=E2=80=99. I'm less sure
> about the right place to do it

Oh right, if that kills --fallback, that=E2=80=99s a problem.

Back to your initial patch, what about moving =E2=80=98bad-response=E2=80=
=99 handling to
the call site of =E2=80=98http-multiple-get=E2=80=99 instead of having it in
=E2=80=98http-multiple-get=E2=80=99?  (That way, =E2=80=98http-multiple-get=
=E2=80=99 would behave like
=E2=80=98http-get=E2=80=99 in this respect.)

Upon a =E2=80=98bad-response=E2=80=99, =E2=80=98fetch-narinfos=E2=80=99 wou=
ld return #f or the empty
list or the partial narinfo list it has built so far.

WDYT?

I=E2=80=99d be happy with a patch along these lines!

Thank you,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#26489; Package guix-patches. Full text available.

Message received at 26489 <at> debbugs.gnu.org:


Received: (at 26489) by debbugs.gnu.org; 28 Apr 2017 20:55:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 28 16:55:27 2017
Received: from localhost ([127.0.0.1]:45141 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d4CvH-0001yA-0Q
	for submit <at> debbugs.gnu.org; Fri, 28 Apr 2017 16:55:27 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:57156)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1d4CvE-0001y0-1D
 for 26489 <at> debbugs.gnu.org; Fri, 28 Apr 2017 16:55:24 -0400
Received: from mfilter29-d.gandi.net (mfilter29-d.gandi.net [217.70.178.160])
 by relay7-d.mail.gandi.net (Postfix) with ESMTP id 2F57C380C;
 Fri, 28 Apr 2017 22:55:22 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mfilter29-d.gandi.net
Received: from relay7-d.mail.gandi.net ([IPv6:::ffff:217.70.183.200])
 by mfilter29-d.gandi.net (mfilter29-d.gandi.net [::ffff:10.0.15.180])
 (amavisd-new, port 10024)
 with ESMTP id F0tfzQ9nJwqn; Fri, 28 Apr 2017 22:55:20 +0200 (CEST)
X-Originating-IP: 87.67.124.5
Received: from [192.168.1.24] (5.124-67-87.adsl-dyn.isp.belgacom.be
 [87.67.124.5]) (Authenticated sender: me@HIDDEN)
 by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id CB954381E;
 Fri, 28 Apr 2017 22:55:19 +0200 (CEST)
From: Tobias Geerinckx-Rice <me@HIDDEN>
Subject: Re: bug#26489: [PATCH] substitute: Ignore bad responses.
To: ludo@HIDDEN
References: <20170414002755.32672-1-me@HIDDEN> <87lgr3gvqf.fsf@HIDDEN>
Message-ID: <ca4baf38-3b11-1c8a-a7b1-167f6500c247@HIDDEN>
Date: Fri, 28 Apr 2017 22:56:34 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <87lgr3gvqf.fsf@HIDDEN>
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature";
 boundary="npVXO4qtCh3ejtBqxp5mOos9q2kBDJBPH"
X-Spam-Score: -3.0 (---)
X-Debbugs-Envelope-To: 26489
Cc: 26489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.0 (---)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--npVXO4qtCh3ejtBqxp5mOos9q2kBDJBPH
Content-Type: multipart/mixed; boundary="vflTNfUvuReHV58fGNUqghpgn50k4jVmN";
 protected-headers="v1"
From: Tobias Geerinckx-Rice <me@HIDDEN>
To: ludo@HIDDEN
Cc: 26489 <at> debbugs.gnu.org
Message-ID: <ca4baf38-3b11-1c8a-a7b1-167f6500c247@HIDDEN>
Subject: Re: bug#26489: [PATCH] substitute: Ignore bad responses.
References: <20170414002755.32672-1-me@HIDDEN> <87lgr3gvqf.fsf@HIDDEN>
In-Reply-To: <87lgr3gvqf.fsf@HIDDEN>

--vflTNfUvuReHV58fGNUqghpgn50k4jVmN
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Ludo',

I should really send this message in my Drafts folder since 14/4... :-/

On 14/04/17 11:54, Ludovic Court=C3=A8s wrote:
> Tobias Geerinckx-Rice <me@HIDDEN> skribis:
>> One weird HTTP response from a server will kill =E2=80=98guix substitu=
te=E2=80=99:
>>=20
>> updating list of substitutes from 'https://foo'... 50.0%Backtrace:
>>  ... guix/ui.scm:1229:8: In procedure run-guix-command:=20
>> guix/ui.scm:1229:8: Throw to key `bad-response' with args `("Bad=20
>> Response-Line: ~s" (""))'. error: build failed: substituter=20
>> `substitute' died unexpectedly
>>=20
>> Attached is a patch to ignore such bad responses. The offending=20
>> .narinfo will be ignored for that session, and not cached at all.=20
>> The result:
>=20
> I=E2=80=99m sure you expect this question: what bad responses did you g=
et in=20
> practice?  :-)

In fact, not really. The error message looked unambiguous to me: the
HTTP response (the first line returned to the client, e.g. "HTTP/1.1 200
OK") was simply empty, throwing an exception.

Interestingly, a newline seems to be required.

Using http://bad.http.response.tobias.gr as a substitute server triggers
it. http://no.http.response.tobias.gr does not.

> Usually that is a sign of a broken HTTP server.

I think it's actually something in-between me and the server. I'll take
a closer look next time this happens.

> Of course it=E2=80=99s  widespread enough, we=E2=80=99d better handle i=
t, either in=20
> Guix or directly in (web client) in Guile;

As I read it, (web client) considers throwing a BAD-RESPONSE exception
the best or only way to deal with an error like this. I agree.

> OTOH, if it=E2=80=99s a genuine problem, we=E2=80=99d better not hide i=
t.

Well, we don't hide it, per se. Hence the error message.

I think throwing an unhandled exception is definitely the wrong thing to
do here =E2=80=94 this kills even =E2=80=98guix --keep-going --fallback=E2=
=80=99. I'm less sure
about the right place to do it

Kind regards,

T G-R



--vflTNfUvuReHV58fGNUqghpgn50k4jVmN--

--npVXO4qtCh3ejtBqxp5mOos9q2kBDJBPH
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFBBAEBCgArFiEEeqzfDJ8DWw5d4xcqkczbm0hUG5kFAlkDrIMNHG1lQHRvYmlh
cy5ncgAKCRCRzNubSFQbmWMfCACXx9L0VyzmtAs0U/tG6fQWpRlpPeCxQSUGqCmT
XoFFroX+fZi2EGiL1n5RVsgY0p0CMETK69+TbLQT18nFnzgP1pa8ZD2BCFzgE/sl
TQsHPtTbslF6KfFJlefd2WeNNSjSjr1NhHTzLywjShIFFj659p1ju/W0FJMOEgrd
n99WxofOxN1vyX+Cp5CCTzRpx5gmFmFmyohBzEKOzismJuhE2i2+lAQE6m92DI+7
ldPfxBaLf5vVZ8VF+xHLD0GqKKt1fQ4RHhEf7xa27A4rM6f+2v6l/8WxACq+xjYf
KuystEXSTg0pMphT9sGa7fgdZbqIjcE8db8Q2bp0YJy+8FBH
=y+3J
-----END PGP SIGNATURE-----

--npVXO4qtCh3ejtBqxp5mOos9q2kBDJBPH--




Information forwarded to guix-patches@HIDDEN:
bug#26489; Package guix-patches. Full text available.

Message received at 26489 <at> debbugs.gnu.org:


Received: (at 26489) by debbugs.gnu.org; 14 Apr 2017 09:54:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 14 05:54:47 2017
Received: from localhost ([127.0.0.1]:46471 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cyxwF-0002iC-7A
	for submit <at> debbugs.gnu.org; Fri, 14 Apr 2017 05:54:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49807)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1cyxwD-0002i0-L5
 for 26489 <at> debbugs.gnu.org; Fri, 14 Apr 2017 05:54:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <ludo@HIDDEN>) id 1cyxw4-0005xq-1V
 for 26489 <at> debbugs.gnu.org; Fri, 14 Apr 2017 05:54:40 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48470)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1cyxw3-0005xe-Tt; Fri, 14 Apr 2017 05:54:35 -0400
Received: from [193.50.110.181] (port=60894 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1cyxw3-0002Jp-DZ; Fri, 14 Apr 2017 05:54:35 -0400
From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=)
To: Tobias Geerinckx-Rice <me@HIDDEN>
Subject: Re: bug#26489: [PATCH] substitute: Ignore bad responses.
References: <20170414002755.32672-1-me@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 25 Germinal an 225 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-unknown-linux-gnu
Date: Fri, 14 Apr 2017 11:54:32 +0200
In-Reply-To: <20170414002755.32672-1-me@HIDDEN> (Tobias Geerinckx-Rice's
 message of "Fri, 14 Apr 2017 02:27:55 +0200")
Message-ID: <87lgr3gvqf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 26489
Cc: 26489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Howdy!

Tobias Geerinckx-Rice <me@HIDDEN> skribis:

> * guix/scripts/substitute.scm (http-multiple-get): Catch BAD-RESPONSE
> exceptions and keep going.
> ---
>
> Guix,
>
> One weird HTTP response from a server will kill =E2=80=98guix substitute=
=E2=80=99:
>
>   updating list of substitutes from 'https://foo'...  50.0%Backtrace:
>   ...
>   guix/ui.scm:1229:8: In procedure run-guix-command:
>   guix/ui.scm:1229:8: Throw to key `bad-response' with args
>                       `("Bad Response-Line: ~s" (""))'.
>   error: build failed: substituter `substitute' died unexpectedly
>
> Attached is a patch to ignore such bad responses. The offending .narinfo
> will be ignored for that session, and not cached at all. The result:

I=E2=80=99m sure you expect this question: what bad responses did you get in
practice?  :-)

Usually that is a sign of a broken HTTP server.  Of course it=E2=80=99s
widespread enough, we=E2=80=99d better handle it, either in Guix or directl=
y in
(web client) in Guile; OTOH, if it=E2=80=99s a genuine problem, we=E2=80=99=
d better not
hide it.

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#26489; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Apr 2017 00:27:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 13 20:27:14 2017
Received: from localhost ([127.0.0.1]:46258 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cyp50-00044X-E4
	for submit <at> debbugs.gnu.org; Thu, 13 Apr 2017 20:27:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44332)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1cyp4y-00044I-FN
 for submit <at> debbugs.gnu.org; Thu, 13 Apr 2017 20:27:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <me@HIDDEN>) id 1cyp4r-000598-Uf
 for submit <at> debbugs.gnu.org; Thu, 13 Apr 2017 20:27:07 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50,RCVD_IN_SORBS_SPAM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:56635)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <me@HIDDEN>) id 1cyp4r-000591-RZ
 for submit <at> debbugs.gnu.org; Thu, 13 Apr 2017 20:27:05 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35291)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <me@HIDDEN>) id 1cyp4q-0004rD-6r
 for guix-patches@HIDDEN; Thu, 13 Apr 2017 20:27:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <me@HIDDEN>) id 1cyp4n-00058B-1l
 for guix-patches@HIDDEN; Thu, 13 Apr 2017 20:27:04 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:58022)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <me@HIDDEN>) id 1cyp4m-00057g-Sn
 for guix-patches@HIDDEN; Thu, 13 Apr 2017 20:27:00 -0400
Received: from mfilter14-d.gandi.net (mfilter14-d.gandi.net [217.70.178.142])
 by relay2-d.mail.gandi.net (Postfix) with ESMTP id CC644C5A54
 for <guix-patches@HIDDEN>; Fri, 14 Apr 2017 02:26:57 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mfilter14-d.gandi.net
Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194])
 by mfilter14-d.gandi.net (mfilter14-d.gandi.net [::ffff:10.0.15.180])
 (amavisd-new, port 10024)
 with ESMTP id hW0WwWkSp0z1 for <guix-patches@HIDDEN>;
 Fri, 14 Apr 2017 02:26:56 +0200 (CEST)
X-Originating-IP: 81.240.210.34
Received: from v5.tobias.gr (34.210-240-81.adsl-dyn.isp.belgacom.be
 [81.240.210.34]) (Authenticated sender: me@HIDDEN)
 by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 501F4C5A50
 for <guix-patches@HIDDEN>; Fri, 14 Apr 2017 02:26:55 +0200 (CEST)
From: Tobias Geerinckx-Rice <me@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] substitute: Ignore bad responses.
Date: Fri, 14 Apr 2017 02:27:55 +0200
Message-Id: <20170414002755.32672-1-me@HIDDEN>
X-Mailer: git-send-email 2.12.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.5 (---)

* guix/scripts/substitute.scm (http-multiple-get): Catch BAD-RESPONSE
exceptions and keep going.
---

Guix,

One weird HTTP response from a server will kill ‘guix substitute’:

  updating list of substitutes from 'https://foo'...  50.0%Backtrace:
  ...
  guix/ui.scm:1229:8: In procedure run-guix-command:
  guix/ui.scm:1229:8: Throw to key `bad-response' with args
                      `("Bad Response-Line: ~s" (""))'.
  error: build failed: substituter `substitute' died unexpectedly

Attached is a patch to ignore such bad responses. The offending .narinfo
will be ignored for that session, and not cached at all. The result:

  updating list of substitutes from 'https://bar'... 100.0%
  updating list of substitutes from 'https://foo'...   2.9% (bad response)
  updating list of substitutes from 'https://foo'...   5.9% (bad response)

As a nice bonus, guix doesn't keel over and die.

Is this the best solution? A good one? Should it be made more obvious
that only READ-RESPONSE can throw, and that PROC will never be called
with, a bad response? No idea. I haven't had enough free time to learn
good the Guile like I'd so hoped to do at the beginning of the year. :c

Be gentle, dear reader, and all that,

T G-R

 guix/scripts/substitute.scm | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index d3bccf4dd..7eccf9831 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -564,18 +564,24 @@ initial connection on which HTTP requests are sent."
           (()
            (reverse result))
           ((head tail ...)
-           (let* ((resp   (read-response p))
-                  (body   (response-body-port resp))
-                  (result (proc head resp body result)))
-             ;; The server can choose to stop responding at any time, in which
-             ;; case we have to try again.  Check whether that is the case.
-             ;; Note that even upon "Connection: close", we can read from BODY.
-             (match (assq 'connection (response-headers resp))
-               (('connection 'close)
-                (close-connection p)
-                (connect #f tail result))         ;try again
-               (_
-                (loop tail result))))))))))       ;keep going
+           (catch 'bad-response
+             (lambda ()
+               (let* ((resp   (read-response p))
+                      (body   (response-body-port resp))
+                      (result (proc head resp body result)))
+                 ;; The server can stop responding at any time, in which case
+                 ;; we have to try again.  Check whether that's the case.  Note
+                 ;; that we can read from BODY even upon "Connection: close".
+                 (match (assq 'connection (response-headers resp))
+                   (('connection 'close)
+                    (close-connection p)
+                    (connect #f tail result)) ; try again
+                   (_
+                    (loop tail result))))) ; keep going
+             (lambda args
+               ;; This message appears on the same line as the progress report.
+               (format (current-error-port) " (bad response)~%")
+               (loop tail result))))))))) ; keep going
 
 (define (read-to-eof port)
   "Read from PORT until EOF is reached.  The data are discarded."
-- 
2.12.2





Acknowledgement sent to Tobias Geerinckx-Rice <me@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#26489; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.