Categories
fixing your desktop

Firefox bug: Who deleted my cache?

There’s a major bug in Firefox (allthough I left at “normal” severity, leave it to the maintainers to judge) that’s been around since Version 2.0 (maybe earlier). I’m *pretty* sure that Mozilla (i.e. precursor to Firefox) did not have this bug. It’s been bugging me for years, and I’ve seen lots of people complain about it, but the latest release still hasn’t fixed it, so I went hunting. No bugs found.

Not any more:

Bug 525266: Disk cache is deleted when browser restarts

Summary

When web browsers were invented, people noticed that – shock! horror! – the internet is SLOW.

So, all web browsers (ALL web browsers – IIRC it started with Internet Explorer 3.0, which was so amazingly fast thanks to its cache that everything else had to follow suit – but my memory is vague here, this was 15 years ago!) added a Disk Cache, that would keep a copy of each web page on your hard disk, and try to serve it up from the cache rather than download.

Because it was persisted to disk, this performance boost would survive even if your browser crashed (which they did more often back then – this is in the days before Windows NT, when Windows 95 would crash *a lot*).

Fast-forward to 2009: Firefox has a disk-cache, but it’s 99% useless. You (effectively) can ONLY use the FF cache if you have so little RAM that your webpages fit on the cache but not in RAM. This is extremely unlikely for most people.

Why?

Because someone on the FF team decided that everytime they restart the browser, they will hard-code it to delete your cache. What? Why? And where’s the option to turn it off?

(hint: there isn’t one. Type “about:config” into your address bar to see the complete set of options, and search for cache. Try turning everything to the max – no effect. Check by typing in “about:cache”, which tells you how big your caches are and lets you see what’s in them. After a restart – for any reason, including “the browser crashed, and autorestarted” – FF deletes its own cache. Stupid. Very stupid).

4 replies on “Firefox bug: Who deleted my cache?”

Uuuh.

I’ll admit that my configuration is “unusual” (Firefox 3.5 on Ubuntu 9.04/64bit), but here is what I’m observing:

* Firefox does not seem to cache the same things in RAM and on disk – right now, my RAM cache is at 22kB (mainly for Google Reader) and disk cache is at 30MB. Which means that the disk cache is not useless as you describe.
* When closing Firefox properly, the contents of the cache were kept.
* When closing Firefox improperly, (with an xkill), contents of the cache were deleted.

Maybe it’s a Firefox on Mac specific bug? (the bug report you link is also on Mac) At least it doesn’t seem to be an intended behaviour from the firefox developers as you’re describing.

One of my fellow sufferers thought it was by design – I assumed they knew because there was an outstanding WONTFIX bug, but when j searched today I found none.

Bizarrely, when I went to confirm my setup for folllowup bug reports, the disk cage started working.

For the first time EVER – without my changing anything.

WTF?!?

Anyway, I’m going to try and reproduce what makes it happen / not happen and then update the bugreport. On average I see the problem several times a week, so it shouldn’t take long.

Well, I hadn’t caught on the fact that you were the one submitting the bug report.

However, I would argue that there is at least a difference that you don’t seem to consider enough between:
* Proper terminations of the application
* Crashes

By reading your bug report, I’d wager that you’re mainly experiencing crashes. In my opinion, it makes better sense to clear cache after a crash than to risk crashing again in the (arguably rare) case that the cached data is responsible for the crash.

In that case, the “right way” to fix your use cases would be to add a parameter to not wipe disk cache after a crash.

I’ll post something to that effect on the bug report.

Why is there a difference, Jean? Considering how often Firefox 3.5 crashes, this needs to be properly taken into account.

Comments are closed.