New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 640069 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Script loads are incorrectly coalesced

Reported by bzbar...@mit.edu, Aug 23 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:51.0) Gecko/20100101 Firefox/51.0

Example URL:
https://bug1278243.bmoattachments.org/attachment.cgi?id=8781105

Steps to reproduce the problem:
1. Open the developer tools network panel.
2. Check the "Disable cache" option if desired.
3. Load the linked page.

What is the expected behavior?
Two GETs for the script at https://bug1278243.bmoattachments.org/attachment.cgi?id=8781104

What went wrong?
Only one GET for the script.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 54.0.2824.0 (Official Build) dev (64-bit)  Channel: n/a
OS Version: OS X 10.10
Flash Version: 

The HTML spec for this is at https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script and step 18 substep 6 goes to https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script which always performs the fetch in this case.  I'm not seeing any reason there would not be two separate HTTP GETs here, per spec.
 
Cc: brajkumar@chromium.org
Labels: Needs-Feedback
Tested this issue on Mac OS 10.11.6 using chrome latest dev M54-54.0.2824.0 by following steps mentioned below.

1. Opened chrome window and navigated to inspect element
2. Disabled cache from the network panel
3. Loaded the provided URL 
4. Observed 2 Get script in console tab

bzbarsky@- Attaching screen-cast from our end, Could you please confirm is this is the expected behavior of this issue? If yes, please recheck this issue by creating a new profile under chrome://settings with out any apps or extensions in your browser.

Thanks!


640069.mp4
801 KB View Download

Comment 2 by bzbar...@mit.edu, Aug 23 2016

Your video shows one GET for the page itself and one GET for the script.  There should be one GET for the page and two GETs for the script, for three loads total.  So your video is showing the incorrect behavior happening.
Components: -Blink Internals>Network>Cache Blink>Loader
Cc: csharrison@chromium.org
Charles, does this ring any bells for you?  I have some vague memory you've looked at issues like this before.

@bzbarsky: Can you try to reproduce with a new profile as per c# 1?

Cc: hirosh...@chromium.org japhet@chromium.org
Components: -Internals>Network>Cache
Not a network issue, this is all Blink cache.

+japhet,hiroshige for help here, as I'm not familiar with the spec side of things. 

Comment 6 by bzbar...@mit.edu, Aug 24 2016

This happens with a new profile, yes.  It also happens in the video attached with c# 1...
Labels: -Needs-Feedback
I don't have access to a Mac to test right now, but it would be useful to know if Safari also has this problem.

Comment 8 by bzbar...@mit.edu, Aug 24 2016

It does, yes.
Cc: yhirano@chromium.org
The script is preloaded. Blink uses a preloaded resource stored in the memory cache even if the "Disable cache" option is specified.
But should we match two script tags to the same script resource in memory cache? bzbarsky is claiming the spec does not allow this.

I think this is orthogonal to whether or not the scripts are preloaded. The second one just matches the first one in memory cache.
Because there are two identical script tags, I think the more relevant snippet is this one:
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp?rcl=0&l=752

// During the initial load, avoid loading the same resource multiple times for a single document,
// even if the cache policies would tell us to.

This is the logic that coalesces
<script src=X></script>
<script src=X></script>
into one fetch even if neither script initiated a preload.
Yeah, that's true. Even if the server doesn't allow us to reuse the resource, Blink reuses it.
Status: Available (was: Unconfirmed)
I don't think this should be marked available until we know the behavior should change here. We've established that this is currently working as intended for Blink architecture, but should we change Blink architecture to satisfy the spec?
Project Member

Comment 16 by sheriffbot@chromium.org, Aug 25 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Type-Bug -Pri-2 Pri-3 Type-Feature
Loading triage:

According to the spec, at the step 4 of the fetch a classic script algorithms, it does 'perform the fetch'.

https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-perform-fetch

> The algorithms below can be customized by optionally supplying a custom perform the fetch hook,

and

> The hook can also be used to perform more subtle customizations, such as keeping a cache of responses and avoiding performing a fetch at all.

So, the originally reported scenario sounds no-problem in terms of the spec.

The problem here would be

 - multiple requests in the same document are shown as a single request in DevTools
 - server's intention to disallow caching does not affect disk/memory cache since we decide to reuse the same Resource before getting the response header.
 - 'disable cache' does not actually disable the memory cache, but just flush out cached entries on starting page load, though disk cache is disabled as we expect.

These may be a little confusing for DevTools users, but have no real issues

I think these are by design at this point, and wouldn't have a plan unless we found a real problem.
Labels: -OS-Mac
Status: WontFix (was: Untriaged)
Based on analysis at c#17, I'm marking this WONTFIX

Sign in to add a comment