Re: Design Issue: Max Concurrent Streams Limit and Unidirectional Streams

James M Snell <jasnell@gmail.com> Thu, 25 April 2013 19:34 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 E2B8F21F94B1 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 25 Apr 2013 12:34:49 -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 VhEPFR9BpIH3 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Thu, 25 Apr 2013 12:34:49 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id 1F67321F91B2 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Thu, 25 Apr 2013 12:34:49 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1UVRwA-0007qr-W6 for ietf-http-wg-dist@listhub.w3.org; Thu, 25 Apr 2013 19:34:35 +0000
Resent-Date: Thu, 25 Apr 2013 19:34:34 +0000
Resent-Message-Id: <E1UVRwA-0007qr-W6@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 1UVRw2-0007pH-DW for ietf-http-wg@listhub.w3.org; Thu, 25 Apr 2013 19:34:26 +0000
Received: from mail-ob0-f170.google.com ([209.85.214.170]) by lisa.w3.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.72) (envelope-from <jasnell@gmail.com>) id 1UVRvx-0007QQ-FI for ietf-http-wg@w3.org; Thu, 25 Apr 2013 19:34:26 +0000
Received: by mail-ob0-f170.google.com with SMTP id eh20so2893599obb.29 for <ietf-http-wg@w3.org>; Thu, 25 Apr 2013 12:33:55 -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:cc:content-type; bh=cY2nY35c/qbFbWspC2UGa8z3m4xdqEkYaaqHQ2nQk88=; b=xU+mtk/CYdSWUQRtA4s4I4v03O3qjqah+jJkWZXwdECpnstWioFHBX4xM/2MQWm1RB ZTXzr52mBZo/y5vCwjjpxJWwCaO/WK/qVH5Y6825QbRLYItWbVsxLYC4pFJlQUlXlvxD 4fqZOys7YejHZuoAz4fAEFtTqmPj+dnz9npO+rVCswpZwd931mO3eTfWKEd4yxS07FLZ uQGJgBiYVjLLdtxX/+cleSMRMjA3zstFbHbNEFZAIpY8YV42No071z1WyQNrrq2l/eJ2 8Yd4lR1+rXILNvg1Lr1wvpWbt7ttqRVfNpC5TpbqjDUuk5ysg4fbOIAduTc/1FLW/ONE ag8w==
X-Received: by 10.60.92.41 with SMTP id cj9mr16403576oeb.31.1366918435512; Thu, 25 Apr 2013 12:33:55 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.60.3.137 with HTTP; Thu, 25 Apr 2013 12:33:35 -0700 (PDT)
In-Reply-To: <CABkgnnW=Ve=9p2do5PncTVswTYCZqt-LMK50SYCKV1r8zEg=SQ@mail.gmail.com>
References: <CABP7RbdBe-Xkx+CMvpN=_oNAqm6SyLyL+XNHRUKSqn8mjSDw1Q@mail.gmail.com> <CABkgnnW=Ve=9p2do5PncTVswTYCZqt-LMK50SYCKV1r8zEg=SQ@mail.gmail.com>
From: James M Snell <jasnell@gmail.com>
Date: Thu, 25 Apr 2013 12:33:35 -0700
Message-ID: <CABP7Rbc=hYTxuGm7jn=eDipbA23UW3MUc_jx2ALHfqHQt94OJg@mail.gmail.com>
To: Martin Thomson <martin.thomson@gmail.com>
Cc: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=209.85.214.170; envelope-from=jasnell@gmail.com; helo=mail-ob0-f170.google.com
X-W3C-Hub-Spam-Status: No, score=-3.5
X-W3C-Hub-Spam-Report: AWL=-2.652, 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 1UVRvx-0007QQ-FI f651856b4560c7944101a186ce4718f6
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Design Issue: Max Concurrent Streams Limit and Unidirectional Streams
Archived-At: <http://www.w3.org/mid/CABP7Rbc=hYTxuGm7jn=eDipbA23UW3MUc_jx2ALHfqHQt94OJg@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/17575
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>

Perhaps a simpler approach would be to just redefine the limit such
that an endpoint MUST NOT have more than MAX_CONCURRENT_STREAMS in the
Open state at any given time. We have already established that once
the stream is half-closed, new frames cannot be sent, so once the
server half-closes a steam it initiates, the counter is decremented
and the server is permitted to initiate another stream. The client can
choose to reject those additional streams if it chooses.

On Thu, Apr 25, 2013 at 12:25 PM, Martin Thomson
<martin.thomson@gmail.com> wrote:
> On 25 April 2013 10:50, James M Snell <jasnell@gmail.com> wrote:
>> https://github.com/http2/http2-spec/issues/78
>>...
>> If a client sets a limit of 4 concurrent streams, and the server
>> initiates 4 separate PUSH_PROMISE streams that the server half-closes
>> but that are never half-closed by the client, the server will not be
>> able to initiate new push streams for the duration of the session.
>
> Yep, it's a problem.  We got rid of the unidirectional flag that
> addressed this.  I can't speak for others, but I was aware of the
> issue at the time, but I had a solution in mind.  That never got
> written down, partly because we didn't have this discussion :)
>
> On first blush, the only way to avoid the problem is to expect the
> framing layer to be aware of what is going on above, but that's
> probably not sensible.  But there's a better way:
>
> Each stream has two separate state variables, each with three state
> values: no packet yet, open, half-closed.  Streams that have inbound
> == open || outbound == open are "in use" and count toward the stream
> limit.  Documenting this might help clarify how the accounting is
> done.
>
> Importantly, this means that promised streams do not count toward the
> limit.  It does however also imply that implementations will need to
> be careful about how they allocate stream resources.  Pushes
> complicate that a little because the lifecycle of headers doesn't
> match stream lifecycles.  Again, I'd suggest an approach where
> implementations defer commitment of flow control buffers until the
> first flow-controlled frame arrives (memory pre-allocation might be
> advisable for performance reasons, but that would not be an actual
> commitment) and to ensure that any state for send and receive don't
> have the same lifecycle.