MemoryCache gets evicted after header based resources were already preloaded (when devtools are open) |
||||||||
Issue descriptionVersion: M55 OS: OSX (but probably all) What steps will reproduce the problem? (1) Go to https://webplatformdaily.org/ (2) Open dev tools, make sure "Disable cache" is ticked (3) Refresh page What is the expected output? Preloaded resources (e.g. index.css) are supposed to be downloaded once What do you see instead? They are downloaded twice, since all MemoryCache resources get evicted between the time the resource is preloaded and the time it is discovered by the preloadScanner. That only happens when devtools are on, and I strongly suspect either InspectorNetworksAgent::setCacheDisabled() or InspectorNetworkAgent->didCommitLoad() are called between the header based preloading and the preloadScanner and are calling memoryCache()->evictResources().
,
Oct 3 2016
+hiroshige
,
Oct 3 2016
,
Oct 3 2016
I'm assuming (but might be wrong) that the purpose here is not to reuse resources from MemoryCache between navigations when "disable cache" is on. However, if that's indeed the case, we'd need to call this evictResources() sooner, before the header-based preloads are triggered.
,
Oct 3 2016
If that's the only use case (it might not be...) then wouldn't it make sense to just not evict unused preloads? They will be cleared on document detach anyways.
,
Oct 3 2016
That might work, but would require to get the preloads map from ResourceFetcher and pipe it into MemoryCache so it can take it into account. Wouldn't it be easier to call the evictResources() logic sooner?
,
Oct 3 2016
Yeah I'm fine with that but it is a bit more fragile of a solution imo. Hopefully MemoryCache can be refactored to be more preload-aware in the future (as I think it will eventually own preload resources).
,
Oct 3 2016
Could we just use: if (resource->isUnusedPreload()) return in the resource eviction function?
,
Oct 3 2016
I guess we could. I'm still not 100% convinced that we should. What would be more fragile about triggering eviction before any resource might have been preloaded?
,
Oct 3 2016
Generally clearing / evicting resources at set times just seem a bit more dangerous to me. Code evolves and callsites might change slightly, leading to ordering bugs. That being said I think in this case your solution is fine, as long as there's documentation for why we changed the ordering (I'm guessing we're just going to move loadLinksFromHeaders after InspectorInstrumentation::didCommitLoad).
,
Oct 7 2016
,
Oct 7 2016
,
Oct 12 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f78da02239eef5039ce480e8620d30a136918a74 commit f78da02239eef5039ce480e8620d30a136918a74 Author: yoav <yoav@yoav.ws> Date: Wed Oct 12 23:43:42 2016 Avoid MemoryCache eviction of preloaded resources with devtools open Currently, InspectorNetworkAgent::didCommitLoad is evicting all resources from MemoryCache, including ones that were preloaded using headers just before that, which results in double downloads when devtools are open. This CL fixes that, by making sure that this eviction spares unused preloads. BUG= 652187 Review-Url: https://codereview.chromium.org/2385313002 Cr-Commit-Position: refs/heads/master@{#424907} [add] https://crrev.com/f78da02239eef5039ce480e8620d30a136918a74/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads-expected.txt [add] https://crrev.com/f78da02239eef5039ce480e8620d30a136918a74/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads.php [modify] https://crrev.com/f78da02239eef5039ce480e8620d30a136918a74/third_party/WebKit/Source/core/fetch/MemoryCache.cpp [modify] https://crrev.com/f78da02239eef5039ce480e8620d30a136918a74/third_party/WebKit/Source/core/fetch/MemoryCache.h [modify] https://crrev.com/f78da02239eef5039ce480e8620d30a136918a74/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
,
Oct 13 2016
,
Oct 13 2016
Sheriff here. Reopening, as the added test doesn't pass on Win7 (dbg). Given that it's a new test and that it passes everywhere else, I won't revert for now - please try to fix. https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Win7%20%28dbg%29/builds/7710
,
Oct 13 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/50c7b3ce18404e7b0002b0a7a7fc325fb3e0854b commit 50c7b3ce18404e7b0002b0a7a7fc325fb3e0854b Author: msramek <msramek@chromium.org> Date: Thu Oct 13 09:55:33 2016 Disable network-disable-cache-preloads.php on Win7 (dbg) NOTRY=true TBR=yoav@yoav.ws BUG= 652187 Review-Url: https://codereview.chromium.org/2410863006 Cr-Commit-Position: refs/heads/master@{#424992} [modify] https://crrev.com/50c7b3ce18404e7b0002b0a7a7fc325fb3e0854b/third_party/WebKit/LayoutTests/TestExpectations
,
Dec 9 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/78b9ba0dd94faec1f861a6e2e2c061fc909fecae commit 78b9ba0dd94faec1f861a6e2e2c061fc909fecae Author: yhirano <yhirano@chromium.org> Date: Fri Dec 09 04:56:01 2016 Mark http/tests/inspector/network/network-disable-cache-preloads.php as flaky It has been marked as flaky on Win7 Debug but it is flaky on all debug bots. BUG= 652187 NOTRY=true TBR=asargent@chromium.org, grt@chromium.org, vasilii@chromium.org Review-Url: https://codereview.chromium.org/2565653002 Cr-Commit-Position: refs/heads/master@{#437471} [modify] https://crrev.com/78b9ba0dd94faec1f861a6e2e2c061fc909fecae/third_party/WebKit/LayoutTests/TestExpectations
,
Dec 14 2016
Since issue is fixed, but the bug kept open due to flaky test, downgrading priority
,
Jan 3 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5a1b7255488614f897206baaee7f537b0b99e41d commit 5a1b7255488614f897206baaee7f537b0b99e41d Author: yoav <yoav@yoav.ws> Date: Tue Jan 03 15:08:00 2017 Deflake network-disable-cache-preloads The test was flaky due to its use of an expected.txt file combined with unused preloads warnings. Moving this test to an HTML expected file should make the flakiness go away. BUG= 652187 Review-Url: https://codereview.chromium.org/2608163002 Cr-Commit-Position: refs/heads/master@{#441124} [modify] https://crrev.com/5a1b7255488614f897206baaee7f537b0b99e41d/third_party/WebKit/LayoutTests/TestExpectations [add] https://crrev.com/5a1b7255488614f897206baaee7f537b0b99e41d/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads-expected.html [delete] https://crrev.com/f176e05cf23ff77ceffda2e22caa0a71814bb403/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads-expected.txt [modify] https://crrev.com/5a1b7255488614f897206baaee7f537b0b99e41d/third_party/WebKit/LayoutTests/http/tests/inspector/network/network-disable-cache-preloads.php
,
Jan 3 2017
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by csharrison@chromium.org
, Oct 3 2016