From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5BAN-0008Ef-TZ for guix-patches@gnu.org; Mon, 01 May 2017 09:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5BAM-0004Bv-NR for guix-patches@gnu.org; Mon, 01 May 2017 09:15:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:50432) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5BAM-0004Bp-K1 for guix-patches@gnu.org; Mon, 01 May 2017 09:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d5BAM-00041d-F0 for guix-patches@gnu.org; Mon, 01 May 2017 09:15:02 -0400 Subject: bug#26489: [PATCH] substitute: Ignore bad responses. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170414002755.32672-1-me@tobias.gr> <87lgr3gvqf.fsf@gnu.org> Date: Mon, 01 May 2017 15:14:44 +0200 In-Reply-To: (Tobias Geerinckx-Rice's message of "Fri, 28 Apr 2017 22:56:34 +0200") Message-ID: <87o9vc3eij.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Tobias Geerinckx-Rice Cc: 26489@debbugs.gnu.org Hi! Tobias Geerinckx-Rice skribis: > On 14/04/17 11:54, Ludovic Court=C3=A8s wrote: >> Tobias Geerinckx-Rice 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.