Why does Firefox delete disk cache files at startup?
Win10 and FF75. Not at closing (this function is disabled), but at startup. This can be seen in about:cache and the size of the folder allocated for disk cache. Is any setting responsible for this? Is this normal or is it something I did?
Opaite Mbohovái (7)
Some AV software will do this automatically. Check those settings as well.
Is the allotted size of the cache changing in about:config? If so, perhaps Firefox is recalculating it based on available disk space. That could affect its decision on whether to keep or toss files. You could check this parameter from time to time:
(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
(2) In the search box in the page, type or paste cache and pause while the list is filtered
(3) Check the value of the browser.cache.disk.capacity preference
More info on about:config: Configuration Editor for Firefox.
- - - -
I don't know whether it's still true, but back in the day, if Firefox detected at startup that it had crashed instead of shutting down normally, then it would invalidate the existing cache. Are you doing a regular Firefox shutdown with the Exit command, or by using X on the last window, or letting Windows "kill" Firefox?
You can check sessionCheckpoints.json in the profile folder to see if there are pending actions.
You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.
- Help -> Troubleshooting Information -> Profile Folder/Directory:
Windows: Open Folder; Linux: Open Directory; Mac: Show in Finder - https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data
arugula said
Some AV software will do this automatically. Check those settings as well.
I don't have a third-party antivirus, and the built-in in Windows is disabled.
jscher2000 said
Is the allotted size of the cache changing in about:config? If so, perhaps Firefox is recalculating it based on available disk space. That could affect its decision on whether to keep or toss files.
In about:config I have:
browser.cache.disk.capacity = 2097152
browser.cache.disk.filesystem_reported = 1
browser.cache.disk.free_space_hard_limit = 1024
browser.cache.disk.free_space_soft_limit = 5120
browser.cache.disk.smart_size.enabled = false
A symbolic link to the folder has been created for the folder with the cache, which is located in the partition where more than 90 GB is free. On the partition where the link itself is located 85 GB if free.
cor-el said
You can check sessionCheckpoints.json in the profile folder to see if there are pending actions.
File contents before closing the browser: {"profile-after-change":true,"final-ui-startup":true,"sessionstore-windows-restored":true}
After: {"profile-after-change":true,"final-ui-startup":true,"sessionstore-windows-restored":true,"quit-application-granted":true,"quit-application":true,"sessionstore-final-state-write-complete":true,"profile-change-net-teardown":true,"profile-change-teardown":true,"profile-before-change":true}
The problem turned out to be in an extension that allows you to bypass the blocking of providers to access a specific site (like a proxy) - https://addons.mozilla.org/ru/firefox/addon/%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF-%D0%BA-%D1%80%D1%83%D1%82%D1%80%D0%B5%D0%BA%D0%B5%D1%80%D1%83/?src=search
When it's turned on, for some reason, the cache is cleared (at once). When the browser starts, the cache is also cleared if this extension is enabled. Moreover, for other users, as I understand it, this does not happen. Well, okay.
In extension files I see lines like:
function applyProxy(proxyListener, proxyHosts) {
browser.proxy.onRequest.removeListener(proxyListener); browser.proxy.onRequest.addListener(proxyListener, {urls: ["<all_urls>"]}); console.log('Proxy has been set'); clearCacheAndReloadCurrentTab(proxyHosts);
}
function clearCacheAndReloadCurrentTab(proxyHosts) {
browser.browsingData.removeCache({since:getOneDayAgoTimestamp()}, function() { console.log('Cache has been cleared'); reloadCurrentTabIfMatch(proxyHosts);
But I can’t do anything, because when I change these files, there is a problem with the signature or something. I will use it as is then :( I just don’t understand why for others the cache is not cleared when using this extension. Maybe the smart cache is to blame or something. In this case it must be turned on or else.
Moambuepyre
Possibly it is necessary to clear cache to avoid mismatched files retrieved over different connections?
Although the extension is designed to clear only the latest day's cache, in fact, Firefox does support date ranges for clearing the cache and clears the whole thing (according to the MDN page for browser.browsingData.removeCache).