Issue metadata
Sign in to add a comment
|
resource is not served from the cache after performing explicit conditional request
Reported by
alexsuvo...@unity3d.com,
Sep 2 2016
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 Example URL: http://files.unity3d.com/alexsuvorov/bugs/chrome-revalidation/ Steps to reproduce the problem: open http://files.unity3d.com/alexsuvorov/bugs/chrome-revalidation/ 1. click the "get" button: "test.dat" resource is downloaded using XMLHttpRequest (responseText returns "Hello World!"), revalidation response headers are remembered if present (in this specific case, the "Last-Modified" header is stored in the test.revalidateHeaders) 2. click the "revalidate" button: "test.dat" resource is requested with explicitly set "If-Modified-Since" header (using setRequestHeader) having the previously remembered "Last-Modified" value. The server responds with 304 as expected and 304 status is passed to the XMLHttpRequest along with the empty response body as expected. 3. click the "get" button again: "test.dat" resource is downloaded using XMLHttpRequest. The procedure is identical to step 1, however, the browser now passes 304 and a zero-length response, even though no additional headers have been set this time (unlike step 2, where such result would be expected) What is the expected behavior? Non-conditional requests to an existing resource should return status 200 and a valid response body, regardless of the previously executed conditional requests to the same resource. What went wrong? Browser does not pass the cached response body to the XMLHttpRequest after conditional request has been executed for the resource. Did this work before? Yes Works correctly at least in Chromium 47.0.2516.0 Chrome version: 53.0.2785.89 Channel: stable OS Version: 10.0 Flash Version: The issue is not specific to the mentioned server and can be reproduced on other servers as well. The issue is present in 55.0.2847.0 canary. The issue is not reproducible in recent versions of Firefox or Safari. Reopening the tab fixes the issue.
,
Sep 2 2016
FWIW, in Chrome 39, *if* the XHR is not async, I see the same behavior. Perhaps the regression is somehow related related to https://bugs.chromium.org/p/chromium/issues/detail?id=570622 ?
,
Sep 2 2016
Good find! That well could well be related. [+japhet, +yoav]: This issue sounds related to issue 570622 , which you fixed in https://codereview.chromium.org/1558703002.
,
Sep 2 2016
I think maybe I was mislead by similar symptoms but an unrelated root cause, because the CL in question only seems to have changed the behavior of Sync XHR and that isn't in use in this bug. For this repro, no matter how many times I hit the GET Button, the Network Events log only contains one URL_REQUEST / DISK_CACHE_ENTRY pair for http://files.unity3d.com/alexsuvorov/bugs/chrome-revalidation/test.dat, until I hit the REVALIDATE Button, which creates its own URL_REQUEST/DISK_CACHE_ENTRY pair every time it is clicked. After that point, for the lifetime of the tab, every click on the GET Button creates another URL_REQUEST/DISK_CACHE_ENTRY pair. That suggests to me that there's a memory cache between the XHR and the network stack and it's servicing all of the plain XHR GET requests initially. Then the custom request with the cache-validation headers is made and its response (Warning: guessing here) evicts the original memory cache entry for the resource. At that point, all subsequent requests are deemed to require validation and the If-Modified-Since/ETAG pair is added to the network request which hits the DISK_CACHE entry.
,
Sep 2 2016
NOT REPRO: 52.0.2733.0 dfad350a05c0affd2819a8e5b8025d50c7aa5508-refs/heads/master@{#393034} REPRO: 52.0.2733.0 fe8a72da89b1941cccdd54a0da548540360286a6-refs/heads/master@{#393044} In this range, the likely candidate seems to be https://codereview.chromium.org/1923003002
,
Sep 2 2016
elawrence: Thanks for the bisect! That CL does look a likely culprit. CCing reviewers, and assigning to patch author. [japhet]: Since this wasn't noticed for all of M52, probably not urgent to fix it, but we should probably have a fix in M55, at least.
,
Sep 7 2016
Marking R-B-S for M55 since a partner (Unity) discovered this and it's affecting their product.
,
Sep 23 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d343f801f8cd63f985180bb4acb9cd4949e4c4b9 commit d343f801f8cd63f985180bb4acb9cd4949e4c4b9 Author: japhet <japhet@chromium.org> Date: Fri Sep 23 23:09:24 2016 Don't attempt to revalidate a Resource with a 304 response. ...which is counter-intuitive. Normally, a revalidation is started on a Resource with a 2xx response. If the revalidation is successful (i.e, a 304 response), Resource updates it's m_response with the headers that were received on the 304 response, but leaves the original 2xx response status code. A Resource with a 304 status code on its m_response therefore received the 304 without thinking it issued a revaldation. This could happen as a result of a server behaving badly, or it could happen because an XHR was created with manually added revalidation headers. In either case, the Resource is not guaranteed to have sufficient information to perform a successful revalidtion, so don't attempt a revalidation with it. BUG= 643659 TEST=ResourceTest.Revalidate304 Review-Url: https://codereview.chromium.org/2341893002 Cr-Commit-Position: refs/heads/master@{#420771} [modify] https://crrev.com/d343f801f8cd63f985180bb4acb9cd4949e4c4b9/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp [modify] https://crrev.com/d343f801f8cd63f985180bb4acb9cd4949e4c4b9/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
,
Sep 23 2016
,
Sep 23 2016
Very nice. Thanks Nate for fixing this and adding a regression test. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by mmenke@chromium.org
, Sep 2 2016Components: -Internals>Network Internals>Network>Cache