Re: INVALID_STREAM and STREAM_ALREADY_CLOSED

Martin Thomson <martin.thomson@gmail.com> Tue, 26 March 2013 20:35 UTC

Return-Path: <ietf-http-wg-request@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 13E7D21F8D32 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 26 Mar 2013 13:35:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.374
X-Spam-Level:
X-Spam-Status: No, score=-10.374 tagged_above=-999 required=5 tests=[AWL=-0.075, BAYES_00=-2.599, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kP7aBZKPRiRZ for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 26 Mar 2013 13:35:12 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 4E4AB21F8C8F for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 26 Mar 2013 13:35:12 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1UKaZq-0005IW-Uv for ietf-http-wg-dist@listhub.w3.org; Tue, 26 Mar 2013 20:34:38 +0000
Resent-Date: Tue, 26 Mar 2013 20:34:38 +0000
Resent-Message-Id: <E1UKaZq-0005IW-Uv@frink.w3.org>
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <martin.thomson@gmail.com>) id 1UKaZf-0005HN-Jm for ietf-http-wg@listhub.w3.org; Tue, 26 Mar 2013 20:34:27 +0000
Received: from mail-we0-f181.google.com ([74.125.82.181]) by lisa.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <martin.thomson@gmail.com>) id 1UKaZe-00049N-JM for ietf-http-wg@w3.org; Tue, 26 Mar 2013 20:34:27 +0000
Received: by mail-we0-f181.google.com with SMTP id d7so1469897wer.40 for <ietf-http-wg@w3.org>; Tue, 26 Mar 2013 13:34:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=4QTzN/A3Hb9Bhp/hktkT9dRVBVv8WGwMvZIWHOShdmM=; b=eI3Mr5pAl4uV7TPSOpYnjaryQtGW97vAI2gcBKZW+t6COlnJ2xBd147ZSQnKhgb5kr 2vPzf4mKq7l8zfqRW2+gee982z+iRaowz8v5OoFrBH146/TTx8bzGASxk+pVLMcB3buA iPfG2FNFPPfM/MS5zcS015NXJOnETxt2g06HQFMUTVNG4JcnaaP93jr62WYyGhPLFgAU Ud5oiARWKz0EZo1JoFkcUCLL+YpP+HLuzkLNmUwh3QMQiEPVwKP9EuEcPLZsTESqg1lM 5yCo9HaBM4wyD/eFGJ10bq+Ll1Pp6RCZVWIBqHIwgLYVTX4/Zns+AYeZTyXI8ttwCjjF AtiA==
MIME-Version: 1.0
X-Received: by 10.180.103.40 with SMTP id ft8mr5626901wib.28.1364330040477; Tue, 26 Mar 2013 13:34:00 -0700 (PDT)
Received: by 10.194.5.135 with HTTP; Tue, 26 Mar 2013 13:34:00 -0700 (PDT)
In-Reply-To: <CAA4WUYj2T3QAC9wimrOHfU1V3C3hL2sXt4W81xGk8DZCGCnWpQ@mail.gmail.com>
References: <CABkgnnX+26FBCk0VFTEC4sPBrt4DMqWSSdFcvFRVPVYLiCOLng@mail.gmail.com> <CAP+FsNcy1KA0qs=knJzfyfcwjUbWAsWGB9zL5PjAFbrp+V5OwA@mail.gmail.com> <CAA4WUYj2T3QAC9wimrOHfU1V3C3hL2sXt4W81xGk8DZCGCnWpQ@mail.gmail.com>
Date: Tue, 26 Mar 2013 13:34:00 -0700
Message-ID: <CABkgnnWh5=Cf_WvNyRStYb8ogW3S8tHBQf7VVAMuMPRXxwM7VA@mail.gmail.com>
From: Martin Thomson <martin.thomson@gmail.com>
To: "William Chan (陈智昌)" <willchan@chromium.org>
Cc: Roberto Peon <grmocg@gmail.com>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=74.125.82.181; envelope-from=martin.thomson@gmail.com; helo=mail-we0-f181.google.com
X-W3C-Hub-Spam-Status: No, score=-4.4
X-W3C-Hub-Spam-Report: AWL=-1.694, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001
X-W3C-Scan-Sig: lisa.w3.org 1UKaZe-00049N-JM 28f8f1c7c3a86f3747c89ebb81cbacec
X-Original-To: ietf-http-wg@w3.org
Subject: Re: INVALID_STREAM and STREAM_ALREADY_CLOSED
Archived-At: <http://www.w3.org/mid/CABkgnnWh5=Cf_WvNyRStYb8ogW3S8tHBQf7VVAMuMPRXxwM7VA@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/17153
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: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On 26 March 2013 12:58, William Chan (陈智昌) <willchan@chromium.org> wrote:
> We used INVALID_STREAM to indicate the client received a SYN_STREAM with an
> associated stream id that does not exist. Maybe we should just terminate the
> session.

There are five potential scenarios, all based on the highest stream
identifier already seen:

1. Message with a stream ID that is higher than the last stream
identifier by more than 2.
Conclusion: No real problem here, just a few gaps in the chain that
mean less efficient use fo .

2. Message with a stream ID that is lower (or equal to) the highest
stream identifier.  That stream is still open.
Conclusion: No problem, that's normal operation.

3. Message with a stream ID that is lower (or equal to) the highest
stream identifier.  That stream is (half-)closed.
Conclusion: STREAM_ALREADY_CLOSED.

4. Client generates a frame with an even numbered stream ID/server
uses an odd stream ID. That stream hasn't been used by the peer yet.
Conclusion: The sender of this frame is supposed to wait for its peer
to send before using those streams.  This might warrant a separate
error code.  Is this what INVALID_STREAM is intended to cover?
Exception: RST_STREAM needs to be valid here to allow PUSH_PROMISE to
work properly.

5. Client generates a frame with an even numbered stream ID/server
uses an odd stream ID. That stream ID has already been used.
Conclusion: No problem, that's called a reply - normal operation.

> STREAM_ALREADY_CLOSED can be confusing since peers don't necessarily know
> that it's already closed unless we maintain the set of old closed stream
> ids.

I never imagined that this would be the case:  If you track open
streams, as you must, all streams that you aren't tracking are closed
if they have an ID lower than the highest tracked stream ID.

> And what if we receive DATA frames for non-existent streams? I guess we
> shouldn't RST_STREAM a non-existent stream, since the stream id is invalid.

Be very clear here.  I like to think of streams as having three
states: unused, active, and closed.  (Note that you might consider
these states to apply separately in both directions.)  What states
correspond to 'non-existent'?  How does one convey an invalid stream
ID?

On Tue, Mar 26, 2013 at 12:34 PM, Roberto Peon <grmocg@gmail.com> wrote:
> I expect that we'll expand the error codes as more implementors find error
> conditions that they want to be able to debug from a client debug
> information, at which point we can re-add any of this.

That is very much true..