Bug 1638062 - Do StartupCache write before lateWriteChecksStage r=froydnj
authorDoug Thayer <dothayer@mozilla.com>
Thu, 14 May 2020 18:58:07 +0000
changeset 530151 5d694d26914a417b47ab675d05c538126cff2d3b
parent 530150 7baa72e0d62ca44b1650f2a87db9c8124b90b045
child 530152 e4c2a5b00ef73bf342d43529df6b53962b8d0971
push id116004
push userdothayer@mozilla.com
push dateThu, 14 May 2020 19:05:34 +0000
treeherderautoland@5d694d26914a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1638062
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1638062 - Do StartupCache write before lateWriteChecksStage r=froydnj We already ensure that we finish our write before doing a fast shutdown, but right now there's just too much noise in the late write checking telemetry because of this. Differential Revision: https://phabricator.services.mozilla.com/D75389
xpcom/base/AppShutdown.cpp
--- a/xpcom/base/AppShutdown.cpp
+++ b/xpcom/base/AppShutdown.cpp
@@ -137,21 +137,26 @@ void AppShutdown::Init(AppShutdownMode a
   // Very early shutdowns can happen before the startup cache is even
   // initialized; don't bother initializing it during shutdown.
   if (auto* cache = scache::StartupCache::GetSingletonNoInit()) {
     cache->MaybeInitShutdownWrite();
   }
 }
 
 void AppShutdown::MaybeFastShutdown(ShutdownPhase aPhase) {
-  if (aPhase == sFastShutdownPhase) {
-    StopLateWriteChecks();
+  // For writes which we want to ensure are recorded, we don't want to trip
+  // the late write checking code. Anything that writes to disk and which
+  // we don't want to skip should be listed out explicitly in this section.
+  if (aPhase == sFastShutdownPhase || aPhase == sLateWriteChecksPhase) {
     if (auto* cache = scache::StartupCache::GetSingletonNoInit()) {
       cache->EnsureShutdownWriteComplete();
     }
+  }
+  if (aPhase == sFastShutdownPhase) {
+    StopLateWriteChecks();
     RecordShutdownEndTimeStamp();
     MaybeDoRestart();
 
 #ifdef MOZ_GECKO_PROFILER
     profiler_shutdown(IsFastShutdown::Yes);
 #endif
 
     DoImmediateExit();