Closed Bug 59013 Opened 25 years ago Closed 24 years ago

hash table inconsistency in nsReplacementPolicy

Categories

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

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED
mozilla0.9

People

(Reporter: scottputterman, Assigned: gordon)

Details

I thought that my changes to 58186 were causing this but it turns out that they just made this more noticeable since it made it possible to get into this situation. In nsReplacementPolicy::DeleteCacheEntry I often his this assertion: NS_ASSERTION(0, "hash table inconsistency"); I think I know the reason why now. When loading all of the records from the disk we create a dbenumerator and call GetNext on it. However, GetNext always returns the same record, it just fills in the data using the same memory. The comment actually says that if you want to keep around an individual record that you need to clone or dup it. What ends up happening is that in AssociateCacheEntryWithRecord we continually add cacheentries to mRankedEntries that are all pointing to the same record. As each new record is filled in, they all end up pointing to the same data instead of the data they used to point to. Now, when we are trying to delete entries so we can add more, we might actually delete one of these records that has a duplicate. That means that when we try to delete another one of these records, when it gets to DeleteCacheEntry, it won't be able to find a record to delete and it will give that assertion. Basically, I think we need to dup or clone these records so that each cache entry has its own record.
Will be resolved when new cache code lands.
Assignee: neeti → gordon
Target Milestone: --- → mozilla0.9
marking fixed per engineers comments and that new cache has landed
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.