Closed Bug 1206392 Opened 9 years ago Closed 8 years ago

Firefox can't load websites but other browsers can - trash dirs in cache2 dir

Categories

(Core :: Networking: Cache, defect)

40 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1268922

People

(Reporter: klorinczi, Assigned: michal)

Details

(Whiteboard: [necko-backlog])

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; GWX:QUALIFIED; rv:11.0) like Gecko



Actual results:

After a Firefox restart happened, that Firefox can't load websites but other browsers can.
Started loading webpages in the tabs, but nothing happened, continued to do this until infinite time.

Fix/Solution:
After a long debugging process, I noticed, that in the the /profile/user/cache2 dir, more than 32000 directories was created.
Dirs were named as trash0 .. trash32767
After deleting these trash dirs, Firefox started correctly, webpages loaded correctly.



Expected results:

Firefox should notice, that there are too many trash directories, and delete them.

I would set a maximum limit for trash directories (for example 1000 dirs), and trigger deleting the oldest one until we reach the max dir limit again.
This should happen at beginning of Firefox start.
Component: Untriaged → Networking: Cache
Product: Firefox → Core
klorinczi@gmail.com: Can you reproduce the problem?  It would be interesting to find out why there had been so many trash dirs created.

Have you changed any preferences around caching in your profile?  about:support will tell you.

Let you know we do delete these dirs.  But deleting so many of them is slow, tho definitely should not affect browser experience.  Root cause of the problem is 1) we allow so may trashes to even be created (not sure we can much do about it tho), 2) we block the cache I/O on looking them up during the start up.


Michal: seems like we spend too much time by the trash dir lookup during the start up.  This could be worsen by a slow disk too.  Could we do something simple around here?  Is there any obvious issue we could easily fix?
Flags: needinfo?(michal.novotny)
Flags: needinfo?(klorinczi)
The basic question is how it could happen that you had so much trash directories. We start removing all trash directories 60 seconds after FF start. And we create a trash directory only:

1) When the whole cache is cleared. But cache pinning changed this so that CacheFileIOManager::EvictAll() is no longer used.
2) When doomed subdirectory isn't empty during startup.

So there must be some problem with removing the directories because it's unusual to have more than one trash directory and it should be removed soon. Anyway, once we have 32768 trash directories we have a problem (when RAND_MAX is 32767) since we cannot find any non-existing trash here: http://hg.mozilla.org/mozilla-central/annotate/3cc3b1968524/netwerk/cache2/CacheFileIOManager.cpp#l3080

But we have to trash the directory so we cannot simply fail when we cannot find any non-existing directory after few tries. We should focus on how it could happen that the trash directories weren't deleted. I'll check the code to see if there isn't any obvious bug that could case this.
Assignee: nobody → michal.novotny
Flags: needinfo?(michal.novotny)
Whiteboard: [necko-backlog]
Probably...
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Flags: needinfo?(klorinczi)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.