Closed Bug 1630000 Opened 4 years ago Closed 4 years ago

Hitting Back sometimes shows old cached content

Categories

(Core :: Networking: Cache, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox-esr68 --- wontfix
firefox76 --- wontfix
firefox77 --- wontfix
firefox78 --- verified

People

(Reporter: jesup, Assigned: michal)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, Whiteboard: [necko-triaged])

Attachments

(3 files)

+++ This bug was initially created as a clone of Bug #1545909 +++
+++ This bug was initially created as a clone of Bug #1489624 +++

Still happening; same url for me as always (cnn.com), though people have reported it happening on other sites as well.

Browse to a url; wait long enough for the site to change content. Refresh to see current content (in CNN's case, it may auto-refresh periodically on it's own).

Browse to a sub-page on the site. Hit back. See original content; hitting refresh will load current content. You can now (usually/often) repeat the sequence; sometimes it will stop reproing after 1 or two instances.

I've also seen this across months and a restart - load a profile unused for a long time that was sitting on CNN before it was shut down (or perhaps had visited CNN "recently"). See current content (no refresh needed). Read an article, hit back, see months-old content. Refresh, see current, view article, back see months-old content.

I'll attach a screencast of this recorded against a local m-c build where it's happening repeatedly.

I went to record a debug log of this, and it had stopped reproing (I had to go to a meeting and eat lunch). I'll try to get one next time, though I doubt it will be different than the ones I provided in the past.

Priority: P1 → P3
Whiteboard: [necko-triaged]

I've hit this bug several times this week on Fenix. I had problems to reproduce it when logging was turned on, but in the end I succeeded. The log confirms the theory with RCWN.

This channel creates the cache entry:
2020-04-23 10:47:27.740570 UTC - [Parent 17391: Main Thread]: D/nsHttp Creating nsHttpChannel [this=0x723d606000]

This channel loads newer version, but it isn't stored in the cache due to RCWN:
2020-04-23 15:42:37.406519 UTC - [Parent 17391: Main Thread]: D/nsHttp Creating nsHttpChannel [this=0x723d802000]

This channel loads the old version from the cache because VALIDATE_NEVER flag is used when navigating back in history:
2020-04-23 15:46:23.044312 UTC - [Parent 17391: Main Thread]: D/nsHttp Creating nsHttpChannel [this=0x7234d48000]

Assignee: nobody → michal.novotny
Priority: P3 → P2

There are couple of possible solutions for this:

  1. When network wins we can doom the entry. This will ensure we won't reuse the entry, but we'll probably very often throw away an up-to-date entry.

  2. When network wins we can always recreate the entry and store the new content. But the network won probably because the storage was busy and storing new content would just increase the load. IIRC, this was the reason why we decided to not cache the new content.

  3. We could remember (probably in CacheIndex) that the entry wasn't used and might contain an old content. We wouldn't allow to use such entry without re-validation. For this we would need to ignore VALIDATE_NEVER flag.

I have seen this issue for a long time since 1 release before e10s was enabled (that’s Firefox 47?)

(In reply to Kohei Yoshino [:kohei] from comment #5)

I have seen this issue for a long time since 1 release before e10s was enabled (that’s Firefox 47?)

In your case the cause is different because RCWN was enabled in mozilla59 on desktop and in mozilla62 on mobile.

If we're racing cache with network and the network wins we don't have a cache entry for writing the downloaded data. In this case nsHttpChannel::MaybeCreateCacheEntryWhenRCWN() creates the entry synchronously by calling nsICacheStorage::openTruncate() before we initialize cache entry for writing.

Pushed by mnovotny@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/339020d52dcd
Hitting Back sometimes shows old cached content, r=mayhemer,necko-reviewers
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Flags: qe-verify+

Reproduced this issue with Fx nightly build from 2020.04.14 on windows 8.1 x64. Verified fixed with Firefox 78.0b9 on Windows 8.1 x64, macOS 10.15 and on Ubuntu 18.04.

Flags: qe-verify+
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: