Re: Design Issue: Life-cycle of a Stream

James M Snell <jasnell@gmail.com> Wed, 01 May 2013 23:24 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 2E24621F986B for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 1 May 2013 16:24:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.545
X-Spam-Level:
X-Spam-Status: No, score=-10.545 tagged_above=-999 required=5 tests=[AWL=0.054, BAYES_00=-2.599, 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 foBkLfuAtPB9 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 1 May 2013 16:24:12 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id C664921F8B15 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 1 May 2013 16:24:09 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1UXgM1-0004tI-A6 for ietf-http-wg-dist@listhub.w3.org; Wed, 01 May 2013 23:22:29 +0000
Resent-Date: Wed, 01 May 2013 23:22:29 +0000
Resent-Message-Id: <E1UXgM1-0004tI-A6@frink.w3.org>
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <jasnell@gmail.com>) id 1UXgLn-0004sU-4l for ietf-http-wg@listhub.w3.org; Wed, 01 May 2013 23:22:15 +0000
Received: from mail-oa0-f51.google.com ([209.85.219.51]) by lisa.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <jasnell@gmail.com>) id 1UXgLm-0005Xs-D7 for ietf-http-wg@w3.org; Wed, 01 May 2013 23:22:15 +0000
Received: by mail-oa0-f51.google.com with SMTP id g12so24009oah.38 for <ietf-http-wg@w3.org>; Wed, 01 May 2013 16:21:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=1wKwgmqUiOxHlwgVtW0OtNVsv29t1EjCWUIrNIiNMPM=; b=S1GlyX2zIfCCOZgxEXl1ea906eFMmAkMjnxAKn4SQoLHU7mpLbaSgPJ6ucvLkIRrRO CM/0V0EQtRF9fvAn0MZNGWS44bnTPfaMJliPG2kg3AdepNdNaNw2dqK6bm8WP1En+O7b RwN0zmQnNDuoPOqkdb9OkFGPfi4DIue0D27dFlnLEchng4zZTZQ1IZbQE+IhTAaLi82R kCORuO/xV+sduLKuzSAvqsluapxh7dq6mf48Gv3NZp7gai1b8cyL/BVFzwPYCnBNXY/d qAD1cuWeMFuTNJkfgEW7YLv03mSOEORfMFAjvP1PYshxwrDkXtIXgmAgUXPg3rnm1c/T p0+g==
X-Received: by 10.60.141.226 with SMTP id rr2mr1160726oeb.35.1367450508253; Wed, 01 May 2013 16:21:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.60.3.137 with HTTP; Wed, 1 May 2013 16:21:27 -0700 (PDT)
In-Reply-To: <CABP7Rbd08=A6FGA_Huydcx59MWjd7GgBsZ-hcQfAB4mt3d72yQ@mail.gmail.com>
References: <CABP7Rbd08=A6FGA_Huydcx59MWjd7GgBsZ-hcQfAB4mt3d72yQ@mail.gmail.com>
From: James M Snell <jasnell@gmail.com>
Date: Wed, 1 May 2013 16:21:27 -0700
Message-ID: <CABP7RbddZ3TiCG0ZmdVDM=s9yR-WgKRtGLqFX6GUL6EvtuXtmA@mail.gmail.com>
To: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
Content-Type: text/plain; charset=UTF-8
Received-SPF: pass client-ip=209.85.219.51; envelope-from=jasnell@gmail.com; helo=mail-oa0-f51.google.com
X-W3C-Hub-Spam-Status: No, score=-3.5
X-W3C-Hub-Spam-Report: AWL=-2.688, 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 1UXgLm-0005Xs-D7 da9ae8c5366e1edca44e08e2471a320a
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Design Issue: Life-cycle of a Stream
Archived-At: <http://www.w3.org/mid/CABP7RbddZ3TiCG0ZmdVDM=s9yR-WgKRtGLqFX6GUL6EvtuXtmA@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/17773
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>

Ok, based on the feedback given so far, we seem to be in agreement
that promised streams ought to have an independent lifecycle from the
parent stream. Closing the parent, even with an RST_STREAM, ought not
affect any of the associated promised streams, and that the only
association that truly exists between the original and the promised is
that the promised stream inherits headers from the original. Does that
seem accurate? (The header inheritance does raise a number of other
questions but I'll get to those later on). This resolves items 10 and
11.

Items #2 and #4 are still controversial and we need more input to figure it out.

Item #9 is also controversial. Currently the group appears to be
leaning towards requiring that pushed streams are always
unidirectional and automatically half-closed for the receiver.
However, there is the opposing point of view (which I share) that we
ought to allow pushed streams to be optionally bidirectional, even if
http/2 semantics do not make direct use of the bidirectionality. Some
subprotocol later on might.

All of the other items in the lifecycle list appear to be non-controversial.

As for the Tier discussion, we can use the "layer" terminology
instead. How about, "Tier 0" == "Session Layer", "Tier 1" == "Framing
Layer", "Tier 2" == "HTTP/2 Layer". Also, it is suggested that Item C
from my tier 1 in the original note ought to be part of tier 1. That
works for me.

Does that appear to be an accurate assessment?

- James

On Wed, May 1, 2013 at 10:03 AM, James M Snell <jasnell@gmail.com>; wrote:
> The current spec is rather vague on the complete life-cycle of a
> stream within a session. Aside from discussing how the Mommy Endpoint
> and the Daddy Endpoint get together, we ought to take just a bit of
> time to make sure we're all on the same page...
>
> In a separate thread, several of us discussed stream creation...
> specifically, how is a stream initiated. Let's see if we can formalize
> the process and the language. I've written the following out as
> statements, if you disagree with the statement or see it a different
> way, lemme know! Some of this is obvious and well established, I'm
> documenting it here just to make sure we have the complete picture
> captured. I've marked the items that appear to me to be the most
> controversial with an asterisk.
>
> 1. Streams are initialized or opened by sending a HEADERS or
> HEADERS+PRIORITY frame that uses a previously unused stream
> identifier.
>
> 2. Only HEADERS and HEADERS+PRIORITY frames are used to open a stream.
>
> 3. PUSH_PROMISE frames reserve a stream identifier but do not open the stream.
>
> 4. Promised streams are only opened by sending a subsequent HEADERS or
> HEADERS+PRIORITY frame that uses the reserved stream identifier.
>
> 5. All streams are either fully open, half-closed by the client,
> half-closed by the server, or fully closed.
>
> 6. All promised streams are associated with an originating "parent" stream.
>
> 7. A stream is half-closed by sending a frame with the FINAL bit set.
>
> 8. A stream becomes fully-closed when either: a) both endpoints send
> frames with the FINAL bit set or b) either endpoint sends an RST_FRAME
> with that streams identifier.
>
> 9*. Promised streams are automatically half-closed for the recipient.
> That is, when the server sends a PUSH_PROMISE to a client, that
> streams becomes automatically half-closed for the client. The only
> frame the client can send back to the server for that stream are
> RST_STREAM frames.
>
>   -- or --
>
> 9*. Promised streams are handled just like regular streams. The server
> opens the stream and half-closes. The stream does not fully close
> until either the client half-closes it or a RST_STREAM frame is sent
> for that stream.
>
> 10*. Sending an RST_FRAME for a parent stream fully closes that stream
> as well as all associated promised streams.
>
>   -- or --
>
> 10*. Sending an RST_FRAME for a parent stream only closes that stream
> and has no affect on associated promised streams.
>
> 11*. Fully closing a parent stream using symmetric half-closes will
> fully close all associated promised streams.
>
>   -- or --
>
> 11*. Fully closing a parent stream using symmetric half-closes has no
> affect on associated promised streams.
>
> 12. Half or fully closing a promised stream has no impact on the
> parent stream or any associated sibling promised streams.
>
> Ok, so that covers the lifecycle.. let's talk about processing.. this
> is largely a reiteration of my previous note on this but I want to
> make sure I've hit all the major points in how this is categorized.
>
> Tier 1: Includes the following...
>
> A. Reception and basic parsing of frames. "Basic parsing" here means
> looking at the header bytes to determine the frame type, making note
> of the flags, frame size and stream identifier, and performing any
> necessary header block decompression and state management.
>
> B. Handling of all session frames (stream id #0). This means that
> upgrade negotiation, SETTINGS, PING, flow control and session level
> error handling are all Tier 1 processes.
>
> C. Basic lifecycle handling of stream frames. This includes
> determination of whether a stream is open or closed, whether or not
> additional frames are allowed for a stream, validation of proper
> stream id use, reservation of stream id's with push_promise, and
> handling of the FINAL flag.
>
> Tier 2: Includes the following...
>
> A. Frame-type specific processing. Validation and handling of frame
> payloads and frame-specific flags, not including header block
> processing (which is tier 1)
>
> B. Additional stream-level error handling not related to stream-lifecycle
>
> Tier 3: Includes all application-level handling (HTTP Semantics)
>
> So, when we say things like "an endpoint must be prepared to continue
> receiving frames on a closed stream", we mean to say that "an endpoint
> must be prepared to do tier 1 processing on all frames, even those
> sent for closed streams."
>
> Please weigh in on whatever items y'all feel are controversial. I'll
> work up proposed spec edits based on whatever feedback is received.
>
> - James