Closed
Bug 753813
Opened 12 years ago
Closed 12 years ago
Cache is disabled if you have too many old cache directories to delete
Categories
(Core :: Networking: Cache, defect)
Tracking
()
VERIFIED
FIXED
mozilla15
People
(Reporter: bbondy, Assigned: bbondy)
References
Details
(Whiteboard: [Snappy][qa!])
Attachments
(1 file)
1.42 KB,
patch
|
jduell.mcbugs
:
review+
lsblakk
:
approval-mozilla-aurora+
lsblakk
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
As per bug 105843, if we crash or shutdown uncleanly we rename the old cache directory to a random number. We attempt 10 times to find a cache directory name that is unused. We don't currently call srand() though before calling rand(). And so it loops through 10 times once you have 10 such directories and then you have no cache at all. This could lead to all sorts of slowdowns and reports on telemetry data.
Assignee | ||
Comment 1•12 years ago
|
||
By the way, the amount of IO that bug 105843 generates, probably causes significant jank everywhere else that depends on IO (everywhere).
Assignee | ||
Comment 2•12 years ago
|
||
Verified that more than 10 directories can be created now. I noticed because I've been using the Metro browser and unclean shutdown is currently very common there.
Attachment #622755 -
Flags: review?(taras.mozilla)
Assignee | ||
Updated•12 years ago
|
Whiteboard: [Snappy]
Comment 3•12 years ago
|
||
I wonder if any rand() implementations always return the same sequence of results after a particular result regardless of srand(); i.e. is there always extra hidden state or not? If RAND_MAX is 32767 and srand() takes uint32, probably there is hidden state, but it's not mandated. rand() sucks... ;-) What's the test sequence? Why aren't the Trash cache dirs getting deleted to begin with such that you get 10? That seems the more serious bug. That all said, this is certainly an improvement!
Assignee | ||
Comment 4•12 years ago
|
||
It gets deleted over time, so if you have a big cache directory to delete, and your browser crashes 9 other times then you could reach this state. Without srand it was returning the same sequence of 10 numbers in the for loop for me.
Comment 5•12 years ago
|
||
Comment on attachment 622755 [details] [diff] [review] Patch v1. Review of attachment 622755 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for noticing this. The only way we should be able to get lots of undeleted cache directories is if firefox is run over and over without ever getting a chance to run for more than a minute, and crashes (or is killed) each time. (does that match your experience, Brian?) This is because we currently wait for 60 seconds after startup before deleting the old cache directories, in an attempt to prevent slowing down startup. Perhaps that's too long to wait on mobile? So long as we eventually get a chance to delete these directories, it's not too bad to accumulate a number of them (they're not massive: 1/2 MB each). And yes, this whole scheme of deleting (sometimes large + with too many files) Cache directories stinks, and causes lots more I/O than needed. We need to replace it.
Attachment #622755 -
Flags: review?(taras.mozilla) → review+
Assignee | ||
Comment 7•12 years ago
|
||
It is entirely possible that none of my 10 sessions lasted longer than a minute, but the directories can take some time to delete even after started since you have to delete 1 file at a time. But once your cache is disabled for the session, that session may be alive for a long time and your cache will be disabled the whole time.
Comment 8•12 years ago
|
||
> It is entirely possible that none of my 10 sessions lasted longer than a minute
Did you crash each time? You should only get a new Cache.trash-RAND## each time you crash. You can have successful sessions in between the crashes, if they are less than a minute (plus time to delete the old directories, as you point out), and still keep accumulating.
With this fix you should statistically speaking always get a Cache directory. So the risk becomes filling up your disk should you always have sessions than are under a minute or so. I thought that was a minimal risk factor, but perhaps I'm wrong?
Assignee | ||
Comment 9•12 years ago
|
||
If you crash or have an unclean shutdown. In Metro you currently get that commonly, but we might be able to improve that. I probably wouldn't have noticed this if I wasn't using the Metro browser in its current state.
Comment 10•12 years ago
|
||
Comment on attachment 622755 [details] [diff] [review] Patch v1. As close to a zero-risk code patch as you can get (just seeds random number generator, which we forgot to do in orig code). Prevents possible scenario where users who have crashed repeatedly within a minute or so of startup no longer get a Cache for successful sessions, until one of those sessions lasts long enough to delete the old Cache directories. So, not a very common situation (or extremely serious: browser still works, just w/o HTTP cache, so slower). But very low risk. String changes made by this patch: none.
Attachment #622755 -
Flags: approval-mozilla-beta?
Attachment #622755 -
Flags: approval-mozilla-aurora?
Comment 11•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/e460922b0e30
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
Comment 12•12 years ago
|
||
Comment on attachment 622755 [details] [diff] [review] Patch v1. [Triage Comment] thanks for the risk assessment, glad the post-crash user experience will be improved with this fix.
Attachment #622755 -
Flags: approval-mozilla-beta?
Attachment #622755 -
Flags: approval-mozilla-beta+
Attachment #622755 -
Flags: approval-mozilla-aurora?
Attachment #622755 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 13•12 years ago
|
||
https://hg.mozilla.org/releases/mozilla-beta/rev/42098064b016 http://hg.mozilla.org/releases/mozilla-aurora/rev/8b7fbab78d0e
status-firefox12:
--- → affected
status-firefox13:
--- → fixed
status-firefox14:
--- → fixed
status-firefox15:
--- → fixed
Comment 14•12 years ago
|
||
Is there something QA can do to verify this is fixed?
Assignee | ||
Comment 15•12 years ago
|
||
It's not easy to reproduce but I verified it locally.
Comment 16•12 years ago
|
||
Thanks Brian, are you able to verify this fixed in Firefox 13, 14, or 15? or was it just a locally built version?
Assignee | ||
Comment 17•12 years ago
|
||
No only in my locally built version, maybe you can kill firefox and set no access on the folders for your user. The folders should accumulate up until it reaches 10 and then it should disable the cache altogether. I'm not sure about exact details about how to test this though, but something along those lines.
Comment 18•12 years ago
|
||
Adding [qa+] to test along the lines of comment 17, though we aren't sure if that will verify this bug 100%.
Whiteboard: [Snappy] → [Snappy][qa+]
Comment 19•12 years ago
|
||
(In reply to Brian R. Bondy [:bbondy] from comment #17) > No only in my locally built version, maybe you can kill firefox and set no > access on the folders for your user. The folders should accumulate up until > it reaches 10 and then it should disable the cache altogether. I'm not sure > about exact details about how to test this though, but something along those > lines. So in Nightly 2012-05-09 the numbers of cache folders stopped at 10 after end-tasking the FF process multiple times. But I was able to see more than 10 cache folders on Nightly 16.0a1 (2012-06-05) which then disappeared after ~5 min. From my understandings is this the right behavior? And what has to do with this the access on folders for my user ?
Assignee | ||
Comment 20•12 years ago
|
||
That is the purpose of this task yes. There should be more than 10 in the new build as you confirmed, so I would call this verified.
Comment 21•12 years ago
|
||
I'll come back with results from FF 13, 14 and 15, since I've only verified this on FF 16 (latest nightly).
Comment 22•12 years ago
|
||
More than 10 cache folders seen on FF 13 release, FF 14b6 and FF 15 2012-06-04. This is verified fixed.
Status: RESOLVED → VERIFIED
Whiteboard: [Snappy][qa+] → [Snappy][qa!]
You need to log in
before you can comment on or make changes to this bug.
Description
•