If "something is blocking the deletion of those files", wouldn't that also block renaming the cache folder?
Sean Rose (he/him && Senior Data Engineer && Mozilla Corporation) ([email protected] || Slack @srose || Matrix @srose) On Thu, Aug 11, 2022 at 6:23 AM Valentin Gosu <[email protected]> wrote: > On Thu, 11 Aug 2022 at 15:13, Paul Zühlcke <[email protected]> wrote: > >> This is awesome! Thanks for working on it. >> What happens if the disk cache clearing hasn't finished when user starts >> Firefox again? Will they still be able to use the cache? >> > > Good question. The cache folder is renamed, prior to deletion, so we can > be sure the background task has exclusive access to it. A new instance > would start with a completely new cache folder, even if the background task > hasn't finished deleting the old one yet. > > PS. Sorry for forgetting the subject in my previous email 🙂 > > >> On Thu, 11 Aug 2022 at 14:50, Valentin Gosu <[email protected]> >> wrote: >> >>> Hi everyone, >>> >>> As Bug 1705676 - Investigate purging HTTP disk cache using >>> backgroundtasks (out-of-process) >>> <https://bugzilla.mozilla.org/show_bug.cgi?id=1705676> 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 >>> <https://firefox-source-docs.mozilla.org/toolkit/components/backgroundtasks/index.html> >>> 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 >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "[email protected]" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CACQYfiKjNJVMMkPZy%2BF9AXiO1fJ4ieLhRYgwrkwwPRAe3STDWQ%40mail.gmail.com >>> <https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CACQYfiKjNJVMMkPZy%2BF9AXiO1fJ4ieLhRYgwrkwwPRAe3STDWQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups " > [email protected]" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CACQYfiLxz5504%2BiLAHNnz-jv%3DqFb8fZp2KOuKySSMphxEswvnA%40mail.gmail.com > <https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CACQYfiLxz5504%2BiLAHNnz-jv%3DqFb8fZp2KOuKySSMphxEswvnA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "[email protected]" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CAGt_AA1OT7G-87z5aGsXWSJQ877WPriqOYmJGhsWsJ2opOHcKw%40mail.gmail.com.
