Hi everyone,
As
Bug 1705676 - Investigate purging HTTP disk cache using backgroundtasks (out-of-process) is getting closer to landing, I wanted to give everyone a heads-up about this change and the reasoning behind it.
We have a non-default setting in the History settings preferences panel where you may choose to "Clear History when Firefox closes" - which sets the privacy.sanitize.sanitizeOnShutdown pref. If the Cache checkbox is also checked that sets the privacy.clearOnShutdown.cache pref to true.
When both of these prefs are true CacheObserver::ClearCacheOnShutdown() will return true, which will cause Firefox to clear the HTTP disk cache during shutdown. This will block shutdown for however long this takes. If the user has a slow disk, or the user is on Windows and something is blocking the deletion of those files, this will trigger a shutdown hang making Firefox crash. This also leads to a bad user experience as trying to start Firefox again during this time will show the "Firefox is already running message". Eventually a crash dump is produced. Bug 1356853 and bug 1682899 are caused by this specific issue.
In order to avoid these shutdown hangs, we have introduced a new mechanism that uses
background tasks to delegate the deletion of the cache to a separate process that may outlive Firefox. Even if this process is unexpectedly killed (as may happen during shutdown), we spawn it again after Firefox starts up to clean up any directories that may be left.
The plan is to enable this on Windows Nightly in the next few days to evaluate if this does indeed work as expected. Assuming it doesn't cause any issues, we plan to ship it to beta and release at a later date.Please let me know if you have any concerns. Many thanks to Nick Alexander who supported this effort with a lot of reviews and improvements to backgroundtasks.
Thanks,
Valentin