Closed Bug 1863250 Opened 1 year ago Closed 12 days ago

Services.clearData.deleteDataFromBaseDomain evicts unrelated cache entry

Categories

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

Firefox 91
defect

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox135 --- wontfix
firefox136 --- wontfix
firefox137 --- fixed

People

(Reporter: 6k64x4ma, Assigned: emz)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(4 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0

Steps to reproduce:

  1. Launch Firefox with a new profile.
  2. Set devtools.chrome.enabled to true.
  3. Browse for a while to add cache files (e.g. go to https://www.mozilla.org/en-US/firefox/developer/).
  4. Load about:cache.
  5. Run this snippet in the Browser Console.
Services.clearData.deleteDataFromBaseDomain(
  "test.invalid",
  false,
  Services.clearData.CLEAR_NETWORK_CACHE,
  { onDataDeleted: flags => console.log(flags) }
);
  1. Wait until the process is complete.
  2. Duplicate about:cache and compare the two.

Actual results:

  • Many cache entries are evicted.

Expected results:

  • No cache entries should be evicted since there are no entries loaded from test.invalid.

Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=9b2ffc8e850587f349301559d397a384ef5c7508&tochange=b9a82200b994f1d8c24f4cc2881b01f245c82757

Flags: needinfo?(hsohaney)
Component: Data Sanitization → Networking: Cache
Flags: needinfo?(hsohaney)
Product: Toolkit → Core

I was able to reproduce this and am moving it to the correct component

I can't reproduce.

Reporter, could you try to record a http log for this?
Please set MOZ_LOG to timestamp,cache2:5 and also use a clean profile to reproduce.

Thanks.

Flags: needinfo?(6k64x4ma)
Attached file log.txt-main.9888.zip

Here you are. I recorded this using Nightly (Build ID: 20231116093942).

Flags: needinfo?(6k64x4ma)

Thanks for the log.
It appears that when Services.clearData.deleteDataFromBaseDomain is called, we call clearBaseDomain. In clearBaseDomain, CacheFileIOManager::EvictByContext will be called with an empty origin and a base domain. Then, at the end of the function EvictByContextInternal, we create CacheFileContextEvictor to evict entries. Note that in CacheFileContextEvictor, the base domain is not used to check if the entry should be removed. This seems to be the root cause of this bug.

Blocks: necko-cache
Severity: -- → S4
Priority: -- → P2
Whiteboard: [necko-triaged]
See Also: → 1941111
Assignee: nobody → emz
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9464016 - Attachment description: WIP: Bug 1863250 - Support for base domain filtering in CacheFileContextEvictor. r=#necko! → Bug 1863250 - Support for base domain filtering in CacheFileContextEvictor. r=#necko!
Attachment #9464391 - Attachment description: WIP: Bug 1863250 - Update on-disk eviction info logic to support base domain clearing. r=#necko! → Bug 1863250 - Update on-disk eviction info logic to support base domain clearing. r=#necko!
Pushed by ezuehlcke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4c12c68ce87f Support for base domain filtering in CacheFileContextEvictor. r=necko-reviewers,valentin https://hg.mozilla.org/integration/autoland/rev/9dff877d4a91 Update on-disk eviction info logic to support base domain clearing. r=necko-reviewers,valentin https://hg.mozilla.org/integration/autoland/rev/2f9f1d5510d4 Test, r=necko-reviewers,valentin
Flags: needinfo?(emz)
Pushed by ezuehlcke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6c9a9c3a815c Support for base domain filtering in CacheFileContextEvictor. r=necko-reviewers,valentin https://hg.mozilla.org/integration/autoland/rev/ff1d529f6ca5 Update on-disk eviction info logic to support base domain clearing. r=necko-reviewers,valentin https://hg.mozilla.org/integration/autoland/rev/cbbeb9a286aa Test, r=necko-reviewers,valentin
Status: ASSIGNED → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: