Re: Server Push and Caching

Tom Bergan <tombergan@chromium.org> Wed, 24 August 2016 16:33 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 79A0912D544 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 24 Aug 2016 09:33:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.568
X-Spam-Level:
X-Spam-Status: No, score=-7.568 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.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.548, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=chromium.org
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ClhWzK7oHj19 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Wed, 24 Aug 2016 09:33:09 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C281412D548 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Wed, 24 Aug 2016 09:33:08 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1bcb2p-0002s0-Dd for ietf-http-wg-dist@listhub.w3.org; Wed, 24 Aug 2016 16:28:51 +0000
Resent-Date: Wed, 24 Aug 2016 16:28:51 +0000
Resent-Message-Id: <E1bcb2p-0002s0-Dd@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <tombergan@chromium.org>) id 1bcb2e-0002qy-8n for ietf-http-wg@listhub.w3.org; Wed, 24 Aug 2016 16:28:40 +0000
Received: from mail-it0-f49.google.com ([209.85.214.49]) by maggie.w3.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <tombergan@chromium.org>) id 1bcb2c-00068P-7m for ietf-http-wg@w3.org; Wed, 24 Aug 2016 16:28:39 +0000
Received: by mail-it0-f49.google.com with SMTP id f6so43194826ith.0 for <ietf-http-wg@w3.org>; Wed, 24 Aug 2016 09:28:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rWm8KK67W9mgXisvrzbap/Fq/tGXgUegUbehXiGwj8I=; b=K6JD3AOaPnMKesvVlK6OwX1RxrFjBZAw9G42nBdxmLn4JMGKLbCtUhTOzktmF9Q8+N oK9A12fCKrocbC3+9rlUSlIReYjuSCEYElodCrZzDQZ5+zPpK+yGqNyAH2/0Ugups/+T tYltTI0h1yURYUGwEIXT4n5dMhL+5Mnlq7ezY=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rWm8KK67W9mgXisvrzbap/Fq/tGXgUegUbehXiGwj8I=; b=AiYRG/i9yOcxtJ70642KdSga+pc3aUSNmZsddR6AdMzrdum2htSvqtKWIbPwRmpTLI vIMWyquzkEhmAuwYpm0XzitfQqLeRNaojcca9SXDmj9i76JDkvuSk94gEq9lp6g0sq+9 aCUhR22xFtXUe/uSe4fMRS+gVNXxvWxk/WDT5mFIaea0S1YrU2avi+ghqBIX8dgnX2N7 HWON8379wGLGXBoTe+KlrzHtWYeg0bCqTnSYPGT2uRlHPGiKnPr14h/HVhFRvQLSRViP Jsdi+Z8047h/OZaRlAgjSmqH5wQGcemIfCOTPUdfmUXaE8sHOcpt8D++8+g2Sgs7yCGA 4/wQ==
X-Gm-Message-State: AE9vXwP6UAnZHeefaEXBAhGu/vlO224EI1pkinm/GGNspDJIirl9qvpynjjBTzK0LZtonNr1
X-Received: by 10.107.180.5 with SMTP id d5mr5954339iof.62.1472056091735; Wed, 24 Aug 2016 09:28:11 -0700 (PDT)
Received: from mail-it0-f48.google.com (mail-it0-f48.google.com. [209.85.214.48]) by smtp.gmail.com with ESMTPSA id b133sm8864536iti.21.2016.08.24.09.28.10 for <ietf-http-wg@w3.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 09:28:11 -0700 (PDT)
Received: by mail-it0-f48.google.com with SMTP id f6so43193377ith.0 for <ietf-http-wg@w3.org>; Wed, 24 Aug 2016 09:28:10 -0700 (PDT)
X-Received: by 10.36.85.195 with SMTP id e186mr33974594itb.56.1472056090467; Wed, 24 Aug 2016 09:28:10 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.107.48.136 with HTTP; Wed, 24 Aug 2016 09:28:10 -0700 (PDT)
In-Reply-To: <3904FEC0-4362-47A0-886A-B97FB97E2515@mnot.net>
References: <3904FEC0-4362-47A0-886A-B97FB97E2515@mnot.net>
From: Tom Bergan <tombergan@chromium.org>
Date: Wed, 24 Aug 2016 09:28:10 -0700
X-Gmail-Original-Message-ID: <CA+3+x5F+KVMvfDu=+H0-ScqiYbGL5RPcF9wfZ5992Q=xcp1k8A@mail.gmail.com>
Message-ID: <CA+3+x5F+KVMvfDu=+H0-ScqiYbGL5RPcF9wfZ5992Q=xcp1k8A@mail.gmail.com>
To: Mark Nottingham <mnot@mnot.net>
Cc: HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: multipart/alternative; boundary=001a1143b92e5d030d053ad3c475
Received-SPF: pass client-ip=209.85.214.49; envelope-from=tombergan@chromium.org; helo=mail-it0-f49.google.com
X-W3C-Hub-Spam-Status: No, score=-5.5
X-W3C-Hub-Spam-Report: AWL=-0.760, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1bcb2c-00068P-7m 8e7c47e26feaf3ff9161df4f9314dc43
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Server Push and Caching
Archived-At: <http://www.w3.org/mid/CA+3+x5F+KVMvfDu=+H0-ScqiYbGL5RPcF9wfZ5992Q=xcp1k8A@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/32352
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>

Thanks for starting this thread. I have questions about the following quote
from the RFC:

On Tue, Aug 23, 2016 at 9:50 PM, Mark Nottingham <mnot@mnot.net> wrote:
>
> RFC7540, Section 8.2 says:
>
> > Pushed responses are considered successfully validated on the origin
> server (e.g., if the "no-cache" cache response directive is present
> (RFC7234, Section 5.2.2)) while the stream identified by the promised
> stream ID is still open.
>
> This implies that, while that stream is open, the pushed response can be
> used by the cache, even when it contains any (or all) of the following
> cache directives:
>
> * max-age=0
> * no-cache
> * s-maxage=0 (for shared caches)
>
> The underlying principle here is that while the response stream is still
> open, it's semantically equivalent to a "normal" response to a just-issued
> request; it would be senseless to require it to be immediately revalidated
> before handing it to the application for use.
>
> The cache can also store the response, but once the stream is closed, if
> that response is stale -- either because of the presence of one of the
> directives above, or some combination of `Expires`, `Age`, `Date`, and
> `Cache-Control`, it will need to be revalidated before use.
>

Chrome does not implement this. Some discussion starting here:
https://groups.google.com/a/chromium.org/d/msg/net-dev/CCNLknIbzYs/hdMw8qYRAgAJ

I can see why the above sentence was added to the RFC -- there needs to be
some semantics for pushing immediately-stale responses, and the above
sentence seems like reasonable semantics at first glance. However, I'm
concerned that these semantics are not implementable in practice. On the
client side, the user agent will typically store pushed responses in a side
cache until they are matched with an actual request. On the server side,
the server will send END_STREAM with the last DATA frame in the pushed
response. This creates a race where the client may see END_STREAM before
it's done enough processing to realize that it needs the pushed response.
For example, consider cases where the server tries to push an "inlined"
resource, but happens to push the inlined resource before the referencing
HTML tag.

A server might try to avoid this race by holding the stream open, but how
long should it keep the stream open? There's no way for the client to
signal that a pushed response has matched a request. Further, the client
cannot know (in general) if the server is holding a stream open to preserve
validity of the no-cache response or because it's slow to send the final
DATA frames.

I'm not sure what the right semantics are. One option is to allow the user
agent optional leeway to consider the response validated for a longer
period, perhaps using a timeout as Chrome does. Or, perhaps, a browser
might consider a pushed response validated for the duration of the parent
navigation event. Thoughts?