Closed
Bug 54470
Opened 24 years ago
Closed 24 years ago
Calling nsINetDataDiskCache::RemoveAll(...) leads to disk cache corruption.
Categories
(Core :: Networking: Cache, defect, P3)
Core
Networking: Cache
Tracking
()
VERIFIED
FIXED
People
(Reporter: rpotts, Assigned: rpotts)
Details
(Whiteboard: [rtm++] [have fix])
Attachments
(3 files)
2.81 KB,
patch
|
Details | Diff | Splinter Review | |
3.75 KB,
patch
|
Details | Diff | Splinter Review | |
3.87 KB,
patch
|
Details | Diff | Splinter Review |
It appears that RemoveAll(...) should *never* be called. Doing so throws away the underlying cache records, but leaves the nsCachedNetData entries in the cache manager. These "orphaned" entries will cause the disk cache to think it is corrupt when Evict() is called, because the recordID associated with the entry no longer exists (it was removed by RemoveAll()). Since the disk cache cannot locate the record in GetCachedNetDataByID(...) it calls DBRecovery(). Unfortunately, DBRecovery() calls RemoveAll() which just makes things worse :-) Currently, RemoveAll() is called in two situations: 1. When the disk cache is cleared via the prefs panel. 2. Inside of DBRecovery(...) I believe that the RemoveAll() functionality should be moved up into the cache manager. Then the nsCachedNetData entries can be removed along with the cache records.
Assignee | ||
Comment 1•24 years ago
|
||
As an aside... Once RemoveAll() is called, if a URL is revisited, it will *not* reuse the DORMANT nsCachedNetData entry in the cache manager since the record ID returned from nsINetDataCache::GetCachedNetData(...) will *not* match the record ID in the DORMANT entry. The IDs do not match because the disk cache will have created a new entry for the URL (with a new recordID). Since the DORMANT entry is not use a new entry is created by the cache mgr for the same URL :-( This means that the orphaned DORMANT records will remain (like land mines) pushing the cache manager closer to calling Evict() :-) And I thought there was an international treaty against land mines!! -- rick
Assignee | ||
Comment 2•24 years ago
|
||
just adding some random keywords...
Comment 3•24 years ago
|
||
I will do - remove DBRecovery() if GetRecordID() fails - propogate error up - delete entry if this happens Rick saz he will attack this from the top.
Updated•24 years ago
|
Whiteboard: [rtm+]
Comment 4•24 years ago
|
||
Plusing for rtm.
Comment 5•24 years ago
|
||
Comment 6•24 years ago
|
||
Assignee | ||
Comment 7•24 years ago
|
||
Assignee | ||
Comment 8•24 years ago
|
||
I've attached a patch which causes nsCacheManager::Clear(...) to delete both the underlying cache record and the nsCachedNetData entry held by the nsReplacementPolicy... Basically, the fix is to call nsReplacementPolicy::DeleteAtleastOneEntry(...) with a target occupancy of zero... Rather than just telling the underlying cache to remove all its records. -- rick
Whiteboard: [rtm+] → [rtm+] [have fix]
Comment 9•24 years ago
|
||
looks okay from here..sr=mscott
Comment 10•24 years ago
|
||
Marking rtm++. Please check this in as soon as possible.
Whiteboard: [rtm+] [have fix] → [rtm++] [have fix]
Comment 11•24 years ago
|
||
We decided that my patch will go into branch and tip. Rick's patch will go only in the tip. I am building now. Once I test with the latest tree, I will check it in.
Comment 12•24 years ago
|
||
Fix checked in. For testing purpose, rick maybe you should file a separate bug for the other part and then, we can mark this bug fixed and leave it rtm++.
Comment 13•24 years ago
|
||
Is this now all checked in (trunk and branch)? If so, can we mark it fixed?
Comment 14•24 years ago
|
||
Half the patch was checked into the branch. The portion checked into the truck deals with the clear cache button in the pref. Since that is isolated, and the other part had to do with cache corruption, I am marking this fixed. Rick if you want to open another bug for the clear cache button and mark it fixed feel free. I dont think it is required.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 15•24 years ago
|
||
Rick, I think we should check in the patch for the clear cache button in the prefs panel, in the branch too, as this will eliminate DBRecovery being called when the clear button is used. DBRecovery throws away the underlying cache records, but leaves the nsCachedNetData entries in the cache manager. When the nsCachedNetData entry tries to access its mRecord, it contains some freed up value and we crash. See bug 52818 and bug 55616.
Comment 16•24 years ago
|
||
development issues - closing based on engineers comments
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•