New issue
Advanced search Search tips

Issue 677755 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug

Blocking:
issue 632361



Sign in to add a comment

Avoid starting NoStatePrefetch when DevTools is open

Reported by teo8...@gmail.com, Jan 1 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Example URL:

Steps to reproduce the problem:
1. load an image from a server that responds with a 302 redirect
2. clear browser cache
3. load the image again

What is the expected behavior?
1) The 302 redirect should never be cached in the first place. Only 301 redirects should be cached.

2) After clearing browser cache, no cached redirect should remain and the request should go to the server

What went wrong?
1) A 302 redirect is cached. That's idiotic and violates the standards in the first place

2) The 302 response is reused from disk cache even after clearing the cache. That's even more idiotic and a huge issue

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: 55.0.2883.87  Channel: stable
OS Version: 
Flash Version: Shockwave Flash 24.0 r0

This may be a regression. I seem to remember this working correctly. I cleared the cache thousands of times in order to avoid cached redirects and it's the first time I observe this.
 

Comment 1 by teo8...@gmail.com, Jan 1 2017

Thinking about it, caching the 302 response per se may be correct under the conditions where the image itself should be cached.

Anyway, keeping it in the cache even when clearing the cache is obviously a bug, and a really huge one. I don't understand why it's so difficult to just delete EVERY FUCKING THING when clearing the cache (there had already been other issues such as favicons not being deleted from cache).

Comment 2 by junov@chromium.org, Jan 2 2017

Components: -Blink Internals>Network>Cache
Labels: Needs-Feedback
This could be coming from some other prediction service other than the cache. Try disabling the "use a prediction service to load pages more quickly" privacy setting. Does it still happen?

If it still happens, can you gather a net-log of it happening and attach it to this bug? See https://dev.chromium.org/for-testers/providing-network-details for how to collect a net-log trace. Thanks!

Comment 4 by teo8...@gmail.com, Jan 3 2017

> This could be coming from some other prediction service other than the cache. 
> Try disabling the "use a prediction service to load pages more quickly"
> privacy setting.

Even if that was the case, clearing the cache should clear that too.
I'm trying to figure out where the data is being stored so that we can address it.

Comment 6 by teo8...@gmail.com, Jan 3 2017

I see.
Have you already tried to reproduce it yourself? 
Labels: Needs-Triage-M55
I'm unable to reproduce. I tried on http://cr.kungfoo.net/jkarlin/redirect/. If I clear the cache and navigate to http://cr.kungfoo.net/jkarlin/redirect/ again then the 302 page is not served from cache.

Can you try the suggestions from comment #3 to help us debug the problem?
Project Member

Comment 9 by sheriffbot@chromium.org, Jan 11 2017

Labels: -Needs-Feedback Needs-Review
Owner: jkarlin@chromium.org
Thank you for providing more feedback. Adding requester "jkarlin@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Needs-Feedback
Still waiting on a repsonse to comment #3.
Cc: msramek@chromium.org dullweber@chromium.org

Comment 12 by jkarlin@google.com, Jan 17 2017

I don't see the 302 being cached at all, only the final page in my example.   teo8976, can you provide an example page where this issue occurs?

Comment 13 by teo8...@gmail.com, Jan 18 2017

> only the final page in my example

You say "page", that makes me wonder: did you test with an IMAGE, as per the original report? This is about images.
Please be polite. We're only trying to help.

The caching behavior will be the same if it's image or document, though I have added an image example (http://cr.kungfoo.net/jkarlin/redirect/image.html) as well. 

I've adjusted the response cache headers and I do now cache the 302 response. After clearing browsing data the redirect isn't served from cache. So I'm still unable to reproduce the issue. 

Please provide an example site where you're seeing this issue or provide a net-log as requested in comment 3.

Comment 15 by teo8...@gmail.com, Jan 18 2017

I can reproduce it from your very example by opening the image directly (as per the instructions in the original report):
http://cr.kungfoo.net/jkarlin/redirect/image_redirect.php

See the screenshot. The red line is where I cleared the cache.

I do not indeed reproduce it when visiting your html page.


> Please be polite. We're only trying to help.

(I don't think I have been unpolite, anyway) So am I when reporting the bug in the first place, and when providing additional information. You are welcome to ask for additional information; however it's fundamentally wrong to put a bug in the Needs-Feedback status when (A) you are asking for additional information that you can get by testing yourself (it's still ok to ask the OP, they might just be able to provide it more quickly) as in comment 3, or before you have actually followed the "steps to reproduce" as in comments before 14.

Untitled.png
41.1 KB View Download

Comment 16 by teo8...@gmail.com, Jan 18 2017

The issue does seem disappear if I disable "Use a prediction service to load data more quickly"
Here is what I'm doing.

1. Navigate to http://cr.kungfoo.net/jkarlin/redirect/image_redirect.php
2. Navigate to http://cr.kungfoo.net/jkarlin/redirect/image_redirect.php again to verify that it loads from cache
3. Clear browser cache
4. Navigate to http://cr.kungfoo.net/jkarlin/redirect/image_redirect.php

The image_redirect.php file is *not* served from cache for me. After clearing your cache, is http://cr.kungfoo.net/jkarlin/redirect/image_redirect.php still in your chrome://cache listing? If so, are you sure you have "cached images and files" checked when clearing your browsing history?

Comment 18 by teo8...@gmail.com, Jan 18 2017

Do you have "Use a prediction service to load data more quickly" checked?

> are you sure you have "cached images and files" checked when clearing
> your browsing history?

Yep
#16, interesting. I do have the option checked as well.

Did you verify after clearing your cache that the resource is not in chrome://cache?

Comment 20 by teo8...@gmail.com, Jan 18 2017

> Did you verify after clearing your cache that the resource is not 
> in chrome://cache?

Yep, it is not.
Cc: droger@chromium.org lizeb@chromium.org pasko@chromium.org
cc'ing some predictive folks

If it's not in the cache, then my best guess is that some predictive service is fetching the resource ahead of time. Can you start typing the url and, before hitting enter, open a new tab and check your chrome://cache to see if it was inserted? 

Comment 22 by pasko@chromium.org, Jan 23 2017

could it be because of blink memory cache?

re #20: please try to repro in these two modes:

1. after clearing the cache, before loading the image_redirect.php, open a new tab, and only then load the image_redirect.php in the new tab

2. uncheck the checkboxes in about:settings whose name start with "Use a prediction service to"
Note that we do delete blink memory cache when the user chooses to delete cache in chrome://settings/clearBrowserData

Here: https://cs.chromium.org/chromium/src/chrome/browser/browsing_data/browsing_data_remover_impl.cc?q=BrowsingDataRemoverImpl&sq=package:chromium&dr=CSs&l=499
teo8976@, any updates for comment 22?
Project Member

Comment 25 by sheriffbot@chromium.org, Feb 7 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding "Needs-Review" label for tracking.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cleaning up "Needs-Review" label as we are not using this label for triage. Ref  bug 684919 
Labels: -Needs-Review
Project Member

Comment 28 by sheriffbot@chromium.org, Mar 15 2018

Status: Archived (was: Unconfirmed)
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 30 by teo8...@gmail.com, Mar 16 2018

For f***'s sake, will you ever stop this nonsense policy of automatically closing issues "because" they don't get fixed?? It's ridiculous. If anything, an issue that is still open and hasn't been touched for a year should get a boost in priority.

I have just checked that I still observe the issue if I enable the setting "use a prediction service to load pages more quickly".

The steps in comment 17 systematically reproduce the issue (as long as the abovementioned setting is enabled; they don't if it isn't).

I understand not everybody is able to reproduce it, and I may have failed to reply to some requests for additional information, but none of these is a reason for closing an issue that is not fixed, especially one that has quite disastrous consequences.
Actually yeah now I remember the cause! It IS a cached redirect. It was coming from my application layer. Either WordPress or a hand-rolled one from my NODEJS app. Also... one of them mayb have bee a cached re: https://en.wikipedia.org/wiki/HTTP/1.1_Upgrade_header 
Cc: -pasko@chromium.org -lizeb@chromium.org
Owner: pasko@chromium.org
Status: Assigned (was: Archived)
Assigning to pasko@ as this appears to be related to prediction service.

Comment 33 by pasko@chromium.org, Mar 22 2018

Cc: -droger@chromium.org mattcary@chromium.org
Labels: -Needs-Triage-M55
sorry, was out this week ..

It is WAI for prediction service to feed the cache when the omnibox is touched and in a few other circumstances (see: http://goo.gl/EJjTCM and https://goo.gl/iZcovf). When clearing _history_ the predictor state is cleared as well (you can check with about:predictors). However, when clearing cache, the predictor state is not cleared, making it possible for prefetch to kick in (after >=2 hits, though I could not repro - dunno why).

teo8...: please confirm that clearing the history works as intended for you.

I see how this behavior may be non-intuitive. Among realistic ways to make it less confusing I see:
1. additionally clear the predictor state when cache is cleared (same for cookies?)
2. clarify the cache confusion in the privacy whitepaper

I think (1) will be less confusing and won't hurt the predictor performance much, no immediate drawbacks I can see.

msramek: WDYT? Should we also update the privacy whitepaper if we take (1)?

Comment 34 by teo8...@gmail.com, Mar 22 2018

> teo8...: please confirm that clearing the history works as intended for you.

LOL I'm not going to lose my history for a test. 

> However, when clearing cache, the predictor state is not cleared

Well, that's just wrong. When I clear the cache, I expect every f***ing cached thing to be deleted, unless you provide me with a separate option to clear prediction services cache specifically (and one for every other kind of cache that you have), which doesn't exist, or a broader option which also doesn't exist, to clear "all kinds of cache" (as opposed to what you arbitrarily consider "the" cache). 

It is NOT acceptable to be forced to clear browsing history in order to clear some kind of cache. History has nothing to do with caching.

Comment 35 by pasko@chromium.org, Mar 22 2018

> LOL I'm not going to lose my history for a test.

There are other ways to test:
1. copy your user data directory and test with --user-data-dir
2. delete history only for the past hour (the URL has to be entered in the omnibox during this hour)

> Well, that's just wrong. When I clear the cache, I expect every f***ing cached thing to be deleted

The cache *is* deleted in this case, but when you touch the omnibox the predictor fetches the content again and puts it to disk cache without showing it to you in devtools.

Interestingly you expect every cached thing to be deleted, but the history to remain. Is it because history is not a cache? The predictor service state is not a cache either, this state aggregated by observing the way the the omnibox is used, which does not directly map to cache entries.

Comment 36 by teo8...@gmail.com, Mar 22 2018

> The cache *is* deleted in this case, but when you touch the omnibox the 
> predictor fetches the content again and puts it to disk 
> cache without showing it to you in devtools.

OMG, really?
Then what is clearly wrong is that the requests made by the predictor when typing in the omnibox are not shown in devtools!! Why on earth shouldn't they? If not by default, at least there should be an option such as "show requests made by prediction service", or "show all requests" (including all those that you are hiding for whatever reason)

I expect the devtools to show me EVERY request that is made. Otherwise, debugging is a nightmare as in this case.


By the way, are you absolutely sure that the cached REDIRECT response is also cleared? That is, the redirect served from cache that I see at step 4 in comment 17, is a response that has just been obtained and cached while I was typing in the omnibox, and not the one that had been cached at step 1?

I wish I could check that myself by looking at the devtools.

Comment 37 by teo8...@gmail.com, Mar 22 2018

> Interestingly you expect every cached thing to be deleted, 
> but the history to remain

Of course. The history is not a cached copy of come contents. It's (meta)information on its own. An entry in the history is the fact that on day X at time Y I visited the url Z. Deleting the cached copy of the contents that I got from that url has nothing to do with deleting the information that on that date I visited that URL. I do one or the other for different purposes.



Comment 38 by teo8...@gmail.com, Mar 22 2018

> of come contents

*some

Comment 39 by pasko@chromium.org, Mar 22 2018

Cc: pfeldman@chromium.org
> [...] requests made by the predictor when typing in the omnibox are not shown in devtools!! Why on earth shouldn't they?

Since the requests are initiated outside of the context of the currently open devtools, it is a little difficult to find which instances to attach this request to. Other things the browser initiates (like preconnect or DNS-prefetch) have similar complications and are not showing up in devtools. I guess it will never be a priority to display all these browser smarts 100% correctly in devtools. +pfeldman for authority.

> By the way, are you absolutely sure that the cached REDIRECT response is also cleared?

Yes. Redirects are normal cache entries, when they are cacheable.

Comment 40 by pasko@chromium.org, May 28 2018

Status: WontFix (was: Assigned)

Comment 41 by pasko@chromium.org, May 28 2018

Summary: Display information about NoStatePrefetch in DevTools (was: Cached redirects are kept even after deleting browser cache)

Comment 42 by teo8...@gmail.com, May 29 2018

WTF??

Why WontFix??

You explained that "it is a little difficult" and that "it will never be a priority to display all these browser smarts 100% correctly" but neither of these are good reasons for giving up fixing this.


Cc: dgozman@chromium.org
I think we should disable NoStatePrefetch when DevTools is open for a tab. This is what we do for prerender, and it avoids surprises when someone is debugging their server and sees some extra requests out of nowhere. Can we do that?
Thanks dgozman!

Oh, indeed we could disable all of NoStatePrefetch when at least a single DevTools tab is open.

We still start prerenders (and affect HTTP cache) when DevTools is open for the tab, we just disallow swapping the prerendered WebContents into the tab (in PrerenderManager::SwapInternal). Here we probably want to prevent NoStatePrefetch from _starting_. Is there a chrome/ way to detect DevTools being open for a Profile?
Prerender/NoStatePrefetch is not attached to any initial WebContents. Omnibox prefetches, in particular, are launched from parts of Omnibox code that know nothing about the current tab/webcontents. In other words, I am not sure plumbing tab into something like OmniboxEditModel would be a good idea.

Even if we manage to discard prefetches from Omnibox drawn on top of the current tab-with-devtools, users would still be confused if they touched Omnibox in another window (though it's not that common I am guessing).

Since nostate-prefetch is chrome/-initiated and affects HTTP disk cache, I think the best discarding would be based on state associated with browser+profile.
I see, this makes sense. There is no easy way to find out whether DevTools is there for a profile. For a browser instance, I guess iterating over tabs and using the method above is the easiest way. Does that work?
Blocking: 632361
Cc: pasko@chromium.org
Labels: -Pri-2 Pri-3
Owner: ----
Status: Available (was: WontFix)
Summary: Avoid starting NoStatePrefetch when DevTools is open (was: Display information about NoStatePrefetch in DevTools)
That sounds undesirably O(number of tabs), but I guess workable. Adjusting status.
> 302 redirect should never be cached in the first place. Only 301 redirects should be cached.

Chromium is the odd one out here, All other browsers follow 302 redirects properly, Chromium strips get parameters from the redirect and breaks the "redirect from handler" design pattern.

Sign in to add a comment