Re: Usage of HTTP/2 PROTOCOL_ERROR and INTERNAL_ERROR

Guoye Zhang <guoye_zhang@apple.com> Tue, 03 May 2022 23:51 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 3CA3AC15E6D3 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 3 May 2022 16:51:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.327
X-Spam-Level:
X-Spam-Status: No, score=-8.327 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.575, 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_HI=-5, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=apple.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 ulcnYs6LBQlL for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 3 May 2022 16:51:31 -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 A53E4C159A21 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 3 May 2022 16:51:31 -0700 (PDT)
Received: from lists by lyra.w3.org with local (Exim 4.92) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1nm2GM-0001WX-Cr for ietf-http-wg-dist@listhub.w3.org; Tue, 03 May 2022 23:49:02 +0000
Resent-Date: Tue, 03 May 2022 23:49:02 +0000
Resent-Message-Id: <E1nm2GM-0001WX-Cr@lyra.w3.org>
Received: from titan.w3.org ([128.30.52.76]) by lyra.w3.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <guoye_zhang@apple.com>) id 1nm2GK-0001VX-Vz for ietf-http-wg@listhub.w3.org; Tue, 03 May 2022 23:49:01 +0000
Received: from rn-mailsvcp-ppex-lapp44.rno.apple.com ([17.179.253.48] helo=rn-mailsvcp-ppex-lapp44.apple.com) by titan.w3.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <guoye_zhang@apple.com>) id 1nm2GJ-0006LH-7f for ietf-http-wg@w3.org; Tue, 03 May 2022 23:49:00 +0000
Received: from pps.filterd (rn-mailsvcp-ppex-lapp44.rno.apple.com [127.0.0.1]) by rn-mailsvcp-ppex-lapp44.rno.apple.com (8.16.1.2/8.16.1.2) with SMTP id 243NYJCN021323; Tue, 3 May 2022 16:48:23 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=eUO+einrSoHe1+CX3vTv41+3aKp1gQM+qqytZiXAVbU=; b=CuknBQBzKZvLjsO+lJUjdamNMZRzCBtI2E74PTlaYlKHFrpZyFf18C0DXhnzqUEm0xn8 klBFHMFWjAROo2OfAcMtsE2Icp0v4cbpp5XtHcPVEwwCxuhKttgrZezWais9NiWu+B5/ x3yaQGtjKcbhlQv1O22Qo9v9zf1cmcwAM08K45uOza/RZVVakxf2hlhZsz/ck8zv2tnB fZAol8IK69tI/C4FtGxTUjS6HHjSVSecTLT5txrWJ4q/i5pj0gFwFSQiQxyxbYDdtoMH aCBxLALYn9gRokvOOBPYvRfPIKVjiMdoeQcJQ2gggh9aKAuFuKMNVdFPdJwvI5+70M79 kQ==
Received: from rn-mailsvcp-mta-lapp01.rno.apple.com (rn-mailsvcp-mta-lapp01.rno.apple.com [10.225.203.149]) by rn-mailsvcp-ppex-lapp44.rno.apple.com with ESMTP id 3fs0m848p8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 03 May 2022 16:48:23 -0700
Received: from rn-mailsvcp-mmp-lapp04.rno.apple.com (rn-mailsvcp-mmp-lapp04.rno.apple.com [17.179.253.17]) by rn-mailsvcp-mta-lapp01.rno.apple.com (Oracle Communications Messaging Server 8.1.0.18.20220407 64bit (built Apr 7 2022)) with ESMTPS id <0RBB003Q7ZGNJVC0@rn-mailsvcp-mta-lapp01.rno.apple.com>; Tue, 03 May 2022 16:48:23 -0700 (PDT)
Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp04.rno.apple.com by rn-mailsvcp-mmp-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.16.20220118 64bit (built Jan 18 2022)) id <0RBB01100YZHFU00@rn-mailsvcp-mmp-lapp04.rno.apple.com>; Tue, 03 May 2022 16:48:23 -0700 (PDT)
X-Va-A:
X-Va-T-CD: 7c41845d202abaa5133654699ccc487a
X-Va-E-CD: 726779146fdd1e42631402707a7382b8
X-Va-R-CD: aee177b38a18be3d69bf8c938ca5fcbc
X-Va-CD: 0
X-Va-ID: 14b976cb-31f9-4be9-a3c0-4143aeb75126
X-V-A:
X-V-T-CD: 7c41845d202abaa5133654699ccc487a
X-V-E-CD: 726779146fdd1e42631402707a7382b8
X-V-R-CD: aee177b38a18be3d69bf8c938ca5fcbc
X-V-CD: 0
X-V-ID: 5967f893-bf51-478a-b2e6-684c1bb2b1d1
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.858 definitions=2022-05-03_10:2022-05-02,2022-05-03 signatures=0
Received: from smtpclient.apple (unknown [17.192.40.112]) by rn-mailsvcp-mmp-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.16.20220118 64bit (built Jan 18 2022)) with ESMTPSA id <0RBB004HSZGM7700@rn-mailsvcp-mmp-lapp04.rno.apple.com>; Tue, 03 May 2022 16:48:22 -0700 (PDT)
From: Guoye Zhang <guoye_zhang@apple.com>
Message-id: <BAF07B6C-9628-4183-BB2C-713C5CCF55FC@apple.com>
Content-type: multipart/signed; boundary="Apple-Mail=_B98B48A9-9514-4CDD-B837-3C363DB58F44"; protocol="application/pkcs7-signature"; micalg="sha-256"
MIME-version: 1.0 (Mac OS X Mail 16.0 \(3716.0.7\))
Date: Tue, 03 May 2022 16:48:22 -0700
In-reply-to: <CALGR9oYHu4NCmR4TaNSw=+oYwTzLMF9OPzKuu9bC6xX-GjhLGA@mail.gmail.com>
Cc: Willy Tarreau <w@1wt.eu>, ietf-http-wg <ietf-http-wg@w3.org>
To: Lucas Pardue <lucaspardue.24.7@gmail.com>
References: <C2794B39-B296-497E-A02F-FB5D56511C5F@apple.com> <20220503164718.GD21564@1wt.eu> <CALGR9oYHu4NCmR4TaNSw=+oYwTzLMF9OPzKuu9bC6xX-GjhLGA@mail.gmail.com>
X-Mailer: Apple Mail (2.3716.0.7)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.858 definitions=2022-05-03_10:2022-05-02,2022-05-03 signatures=0
Received-SPF: pass client-ip=17.179.253.48; envelope-from=guoye_zhang@apple.com; helo=rn-mailsvcp-ppex-lapp44.apple.com
X-W3C-Hub-DKIM-Status: validation passed: (address=guoye_zhang@apple.com domain=apple.com), signature is good
X-W3C-Hub-Spam-Status: No, score=-7.0
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.594, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: titan.w3.org 1nm2GJ-0006LH-7f 1a6a2941f650094d3d400f6b56c8e99a
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/BAF07B6C-9628-4183-BB2C-713C5CCF55FC@apple.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/40021
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>


> On May 3, 2022, at 9:59 AM, Lucas Pardue <lucaspardue.24.7@gmail.com> wrote:
> 
> 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

Thanks, these all makes sense. We will make a change to translate them into generic connection lost errors which are retry-able.

Guoye