Re: Usage of HTTP/2 PROTOCOL_ERROR and INTERNAL_ERROR

Lucas Pardue <lucaspardue.24.7@gmail.com> Tue, 03 May 2022 17:01 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 11972C159A20 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 3 May 2022 10:01:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Level:
X-Spam-Status: No, score=-2.751 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.248, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o3cc2O4b-z3n for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 3 May 2022 10:01:49 -0700 (PDT)
Received: from lyra.w3.org (lyra.w3.org [128.30.52.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3FDF1C159825 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 3 May 2022 10:01:48 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1nlvsU-0005jS-TP for ietf-http-wg-dist@listhub.w3.org; Tue, 03 May 2022 16:59:58 +0000
Resent-Date: Tue, 03 May 2022 16:59:58 +0000
Resent-Message-Id: <E1nlvsU-0005jS-TP@lyra.w3.org>
Received: from mimas.w3.org ([128.30.52.79]) by lyra.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <lucaspardue.24.7@gmail.com>) id 1nlvsT-0005iJ-1R for ietf-http-wg@listhub.w3.org; Tue, 03 May 2022 16:59:57 +0000
Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]) by mimas.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <lucaspardue.24.7@gmail.com>) id 1nlvsR-0007R2-Nf for ietf-http-wg@w3.org; Tue, 03 May 2022 16:59:56 +0000
Received: by mail-qv1-xf2d.google.com with SMTP id eq14so2990881qvb.4 for <ietf-http-wg@w3.org>; Tue, 03 May 2022 09:59:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hEvIMioAL3G9620gJh7PBugn9rXYNpyupQCyNUqBlh8=; b=dsBvr+CjyuXj4vr1oNXkRQumHq9OilD01sMyNxOggklJW5R6ITtiYV+XzZQkLnfwue q+qWISehZ+VtpCnoWn22kw+D63lpTsP8v2vo53KS4OIFflYQbaN4TITg/le3RPz1XPnI Ys1zM4lI2EPxEIw7IRPw4j/LlifPqKX/T3UTgfPZCv+hlDawNRuTgpUabo5Zjg0m+SNq NTyBn4/JlzhqaNq3V5qs75qUysOz1qf3R5dy/5Kq4GBKucHhLerM7zgrCtcfk9+zGp+e SejRFzBB2Ti6zW4VMqE0vlFc/ip3xbZa7j+CsR0UwDyjLqa3G5ZFcADKcEjvfGHXqck0 6OkQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hEvIMioAL3G9620gJh7PBugn9rXYNpyupQCyNUqBlh8=; b=VdMDojRDahm+t+3ePt48camjLX8NdpaAJMTqx9Ebuy/yHVJTSDZM9yjAzs6x2DfeK3 rk3DKIdiTdq8bgLNMWgDXfiW2q08sffSClF9yLZtVtYJm69L0fnWljOFYPRytiFGII9C e4z1+dzkDkI8ivU6O0WmtFWyj832CNgXeQkOPonY8QHfVYnHJ0PfbBUcH2bKb0sS8Bnr vEbWPwGjZAHLhyvPgaZYgJH+U8M+3hfq9/a9E3w1uRBZP5Olfl9WiFp0M2pIegVnjITn oSvW0kk0bGov75kitgHy8cApGge2cZL/usgfVOIeR8gcXZF80PehJJMi2/1+QFGEU2pL diAg==
X-Gm-Message-State: AOAM532IsDM/br6wg1F0c11jL2M5rbQDeXjA2MWHbOjTVtm6NyP1tCON qqCHAD5VKfrI49zebXFGeEK4vs4o9k4AuNrFrIg=
X-Google-Smtp-Source: ABdhPJy75pzXZ4rCjmu+cTK8NTF8PqCChYIunfi/nP3KQYcMs9NoImDfGQcqenKeoErO/uXsWYU8c9ZifiasaK0L+28=
X-Received: by 2002:a05:6214:8eb:b0:456:4fd4:6dd2 with SMTP id dr11-20020a05621408eb00b004564fd46dd2mr14296633qvb.75.1651597184813; Tue, 03 May 2022 09:59:44 -0700 (PDT)
MIME-Version: 1.0
References: <C2794B39-B296-497E-A02F-FB5D56511C5F@apple.com> <20220503164718.GD21564@1wt.eu>
In-Reply-To: <20220503164718.GD21564@1wt.eu>
From: Lucas Pardue <lucaspardue.24.7@gmail.com>
Date: Tue, 03 May 2022 17:59:46 +0100
Message-ID: <CALGR9oYHu4NCmR4TaNSw=+oYwTzLMF9OPzKuu9bC6xX-GjhLGA@mail.gmail.com>
To: Willy Tarreau <w@1wt.eu>
Cc: Guoye Zhang <guoye_zhang@apple.com>, ietf-http-wg <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary="00000000000083507105de1e6f43"
Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=lucaspardue.24.7@gmail.com; helo=mail-qv1-xf2d.google.com
X-W3C-Hub-DKIM-Status: validation passed: (address=lucaspardue.24.7@gmail.com domain=gmail.com), signature is good
X-W3C-Hub-Spam-Status: No, score=-4.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, W3C_AA=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: mimas.w3.org 1nlvsR-0007R2-Nf 8c4492d798f42cd9634ed9ed17bd7018
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Usage of HTTP/2 PROTOCOL_ERROR and INTERNAL_ERROR
Archived-At: <https://www.w3.org/mid/CALGR9oYHu4NCmR4TaNSw=+oYwTzLMF9OPzKuu9bC6xX-GjhLGA@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40020
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <https://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

Hey Guoye,

On Tue, May 3, 2022 at 5:50 PM Willy Tarreau <w@1wt.eu> wrote:

> Hi,
>
> On Tue, May 03, 2022 at 02:26:19AM -0700, Guoye Zhang wrote:
> > Hi,
> >
> > We maintain the HTTP client library on Apple's platforms, and with more
> > servers enabling HTTP/2, our error handling logic was recently brought to
> > attention.
> >
> > To my understanding, PROTOCOL_ERROR means that the other side didn't
> > implement the standard correctly, and INTERNAL_ERROR means something
> happened
> > unexpectedly on our side (e.g. crashed). Both of the error codes should
> be
> > fatal and only caused by bugs in software, so we do not attempt to retry
> or
> > perform download resumption.
> >
> > However, nginx is using these error codes for transfers that are too slow
> > causing timeout, which can occur due to bad network connectivity.
> >
> https://github.com/nginx/nginx/blob/master/src/http/v2/ngx_http_v2.c#L4639
> >
> > My question is, should we treat PROTOCOL_ERROR and INTERNAL_ERROR as
> > recoverable errors on the client side?
>
> I would say that PROTOCOL_ERROR could be caused by an intermediary messing
> up with the connection independently on the client, so it could make sense
> to retry only once (or only a few times) in this case. For INTERNAL_ERROR,
> it could be caused by a resource shortage on the server (memory allocation
> issue for example) so here again it could make sense to try again, but be
> even more conservative and maybe not retry instantly. In that regard, the
> suitability of the codes used for slow transfers as indicated above is
> debatable but I think that to some extents it's not much different from
> what we're saying here (at least for INTERNAL_ERROR). For PROTOCOL_ERROR it
> might be a bit more concerning if it claims there are protocol violations
> that do not really happen but maybe a short read results in an incomplete
> frame which itself results in an apparent protocol violation, and in this
> case it could be a bit stretched but understandable. In any case I think
> that retrying can make sense as long as it's only one or a few times and
> no more to avoid making the situation worse.
>

I tend to agree. PROTOCOL_ERROR is defined as " The endpoint detected an
unspecific protocol error. This error is for use when a more specific error
code is not available", i.e. anything could have gone wrong vs NO_ERROR
being nothing went wrong. PROTOCOL_ERROR is a nice escape valve.

I'm not a client author but I'd be inclined to treat H2 stream resets like
I would if a HTTP/1.x transfer was cut short by a connection closure mid
request/response. So retries seem to make sense.

Adapting runtime behaviour based on the error codes sounds quite hard to do
in practice. Error codes seem to be of value when used for debugging a
particular behaviour or trying to detect problems on a macro scale (i.e., a
systematic issue between a client and server deployment).

Cheers
Lucas