Bug 1257216 - Increase toolkit.asyncshutdown.timeout.crash for WinXP. This is only a test and will be backed out in beta46.0b11. r=Yoric, a=lizzard FIREFOX_46_0b10_BUILD1 FIREFOX_46_0b10_RELEASE
☠☠ backed out by 18b4c47bc1c0 ☠ ☠
authorDragana Damjanovic dd.mozilla@gmail.com
Mon, 11 Apr 2016 03:50:00 +0200
changeset 319600 9ea83990839bd513869018e57bcbedb3454b63bb
parent 319599 f0fa0700be78c06c6b2463e94fb39ffac49f6ced
child 319601 bf752737e1d8c236101c0036ff7b1aba2175d0c1
child 326498 b4f7eca44651ec0312283c1d4cde542e2542bd52
push id1079
push userjlund@mozilla.com
push dateFri, 15 Apr 2016 21:02:33 +0000
treeherdermozilla-release@575fbf6786d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric, lizzard
bugs1257216
milestone46.0
Bug 1257216 - Increase toolkit.asyncshutdown.timeout.crash for WinXP. This is only a test and will be backed out in beta46.0b11. r=Yoric, a=lizzard
modules/libpref/init/all.js
toolkit/components/asyncshutdown/AsyncShutdown.jsm
toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js
toolkit/components/terminator/nsTerminator.cpp
toolkit/crashreporter/test/unit/test_crash_AsyncShutdown.js
toolkit/crashreporter/test/unit/test_crash_terminator.js
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -842,17 +842,22 @@ pref("toolkit.telemetry.debugSlowSql", f
 // Whether to use the unified telemetry behavior, requires a restart.
 pref("toolkit.telemetry.unified", true);
 
 // Identity module
 pref("toolkit.identity.enabled", false);
 pref("toolkit.identity.debug", false);
 
 // AsyncShutdown delay before crashing in case of shutdown freeze
-pref("toolkit.asyncshutdown.timeout.crash", 60000);
+pref("toolkit.asyncshutdown.crash_timeout", 60000);
+#if defined(XP_WIN32)
+// We have a separate crash timeout for windows XP and Vista. See bug 1248358.
+pref("toolkit.asyncshutdown.crash_timeout_winxp", 180000);
+#endif
+
 // Extra logging for AsyncShutdown barriers and phases
 pref("toolkit.asyncshutdown.log", false);
 
 // Enable deprecation warnings.
 pref("devtools.errorconsole.deprecation_warnings", true);
 
 // Disable debugging chrome
 pref("devtools.chrome.enabled", false);
--- a/toolkit/components/asyncshutdown/AsyncShutdown.jsm
+++ b/toolkit/components/asyncshutdown/AsyncShutdown.jsm
@@ -73,17 +73,31 @@ Object.defineProperty(this, "gCrashRepor
 const isContent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processType == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
 
 // Display timeout warnings after 10 seconds
 const DELAY_WARNING_MS = 10 * 1000;
 
 
 // Crash the process if shutdown is really too long
 // (allowing for sleep).
-const PREF_DELAY_CRASH_MS = "toolkit.asyncshutdown.crash_timeout";
+var PREF_DELAY_CRASH_MS = "toolkit.asyncshutdown.crash_timeout";
+
+// For Windows XP and Vista we use toolkit.asyncshutdown.crash_timeout_winxp
+// See bug 1248358.
+var os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
+if (os == "Windows") {
+  var version = Cc["@mozilla.org/system-info;1"]
+                  .getService(Ci.nsIPropertyBag2)
+                  .getProperty("version");
+  if (parseFloat(version) < 6.1) {
+    // Less than Win7.
+    PREF_DELAY_CRASH_MS = "toolkit.asyncshutdown.crash_timeout_winxp";
+  }
+}
+
 var DELAY_CRASH_MS = 60 * 1000; // One minute
 try {
   DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS);
 } catch (ex) {
   // Ignore errors
 }
 Services.prefs.addObserver(PREF_DELAY_CRASH_MS, function() {
   DELAY_CRASH_MS = Services.prefs.getIntPref(PREF_DELAY_CRASH_MS);
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js
@@ -37,17 +37,31 @@ function run_test() {
   run_next_test();
 }
 
 add_task(function* test_sendTimeout() {
   const TIMEOUT = 100;
   // Enable testing mode for AsyncShutdown, otherwise some testing-only functionality
   // is not available.
   Services.prefs.setBoolPref("toolkit.asyncshutdown.testing", true);
-  Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", TIMEOUT);
+
+  // For Windows XP and Vista we use toolkit.asyncshutdown.crash_timeout_winxp
+  // See bug 1248358.
+  var crashTimeoutPref = "toolkit.asyncshutdown.crash_timeout";
+  var os = Cc["@mozilla.org/xre/app-info;1"]
+             .getService(Ci.nsIXULRuntime).OS;
+  if (os == "Windows") {
+    var version = Cc["@mozilla.org/system-info;1"]
+                    .getService(Ci.nsIPropertyBag2)
+                    .getProperty("version");
+    if (parseFloat(version) < 6.1) {
+      crashTimeoutPref = "toolkit.asyncshutdown.crash_timeout_winxp";
+    }
+  }
+  Services.prefs.setIntPref(crashTimeoutPref, TIMEOUT);
 
   let httpServer = new HttpServer();
   httpServer.registerPrefixHandler("/", contentHandler);
   httpServer.start(-1);
 
   yield TelemetryController.setup();
   TelemetrySend.setServer("http://localhost:" + httpServer.identity.primaryPort);
   let submissionPromise = TelemetryController.submitExternalPing("test-ping-type", {});
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -43,16 +43,20 @@
 #include "mozilla/unused.h"
 #include "mozilla/Telemetry.h"
 
 // Normally, the number of milliseconds that AsyncShutdown waits until
 // it decides to crash is specified as a preference. We use the
 // following value as a fallback if for some reason the preference is
 // absent.
 #define FALLBACK_ASYNCSHUTDOWN_CRASH_AFTER_MS 60000
+#ifdef XP_WIN32
+#define FALLBACK_ASYNCSHUTDOWN_CRASH_AFTER_MS_WINXP 180000
+#include "mozilla/WindowsVersion.h"
+#endif
 
 // Additional number of milliseconds to wait until we decide to exit
 // forcefully.
 #define ADDITIONAL_WAIT_BEFORE_CRASH_MS 3000
 
 namespace mozilla {
 
 namespace {
@@ -353,19 +357,33 @@ nsTerminator::Start()
   mInitialized = true;
 }
 
 // Prepare, allocate and start the watchdog thread.
 // By design, it will never finish, nor be deallocated.
 void
 nsTerminator::StartWatchdog()
 {
-  int32_t crashAfterMS =
+  int32_t crashAfterMS;
+#if defined(XP_WIN32)
+  if (IsWin7OrLater()) {
+    crashAfterMS =
+      Preferences::GetInt("toolkit.asyncshutdown.crash_timeout",
+                          FALLBACK_ASYNCSHUTDOWN_CRASH_AFTER_MS);
+  } else {
+    crashAfterMS =
+      Preferences::GetInt("toolkit.asyncshutdown.crash_timeout_winxp",
+                          FALLBACK_ASYNCSHUTDOWN_CRASH_AFTER_MS_WINXP);
+  }
+#else
+  crashAfterMS =
     Preferences::GetInt("toolkit.asyncshutdown.crash_timeout",
                         FALLBACK_ASYNCSHUTDOWN_CRASH_AFTER_MS);
+#endif
+
   // Ignore negative values
   if (crashAfterMS <= 0) {
     crashAfterMS = FALLBACK_ASYNCSHUTDOWN_CRASH_AFTER_MS;
   }
 
   // Add a little padding, to ensure that we do not crash before
   // AsyncShutdown.
   if (crashAfterMS > INT32_MAX - ADDITIONAL_WAIT_BEFORE_CRASH_MS) {
--- a/toolkit/crashreporter/test/unit/test_crash_AsyncShutdown.js
+++ b/toolkit/crashreporter/test/unit/test_crash_AsyncShutdown.js
@@ -4,17 +4,32 @@
 // Test that AsyncShutdown report errors correctly
 
 function setup_crash() {
   Components.utils.import("resource://gre/modules/AsyncShutdown.jsm", this);
   Components.utils.import("resource://gre/modules/Services.jsm", this);
   Components.utils.import("resource://gre/modules/Promise.jsm", this);
 
   Services.prefs.setBoolPref("toolkit.asyncshutdown.testing", true);
-  Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 10);
+
+  // For Windows XP and Vista we use toolkit.asyncshutdown.crash_timeout_winxp
+  // See bug 1248358.
+  var crash_timeout_pref = "toolkit.asyncshutdown.crash_timeout";
+  var os = Components.classes["@mozilla.org/xre/app-info;1"]
+             .getService(Components.interfaces.nsIXULRuntime).OS;
+  if (os == "Windows") {
+    var version = Components.classes["@mozilla.org/system-info;1"]
+                     .getService(Components.interfaces.nsIPropertyBag2)
+                     .getProperty("version");
+    if (parseFloat(version) < 6.1) {
+      // Less than Win7.
+      crash_timeout_pref = "toolkit.asyncshutdown.crash_timeout_winxp";
+    }
+  }
+  Services.prefs.setIntPref(crash_timeout_pref, 10);
 
   let TOPIC = "testing-async-shutdown-crash";
   let phase = AsyncShutdown._getPhase(TOPIC);
   phase.addBlocker("A blocker that is never satisfied", function() {
     dump("Installing blocker\n");
     let deferred = Promise.defer();
     return deferred.promise;
   });
@@ -37,17 +52,32 @@ function after_crash(mdump, extra) {
 // Test that AsyncShutdown + OS.File reports errors correctly, in a case in which
 // the latest operation succeeded
 
 function setup_osfile_crash_noerror() {
   Components.utils.import("resource://gre/modules/Services.jsm", this);
   Components.utils.import("resource://gre/modules/osfile.jsm", this);
   Components.utils.import("resource://gre/modules/Promise.jsm", this);
 
-  Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 1);
+  // For Windows XP and Vista we use toolkit.asyncshutdown.crash_timeout_winxp
+  // See bug 1248358.
+  var crash_timeout_pref = "toolkit.asyncshutdown.crash_timeout";
+  var os = Components.classes["@mozilla.org/xre/app-info;1"]
+             .getService(Components.interfaces.nsIXULRuntime).OS;
+  if (os == "Windows") {
+    var version = Components.classes["@mozilla.org/system-info;1"]
+                    .getService(Components.interfaces.nsIPropertyBag2)
+                    .getProperty("version");
+    if (parseFloat(version) < 6.1) {
+      // Less than Win7.
+      crash_timeout_pref = "toolkit.asyncshutdown.crash_timeout_winxp";
+    }
+  }
+  Services.prefs.setIntPref(crash_timeout_pref, 1);
+
   Services.prefs.setBoolPref("toolkit.osfile.native", false);
 
   OS.File.profileBeforeChange.addBlocker("Adding a blocker that will never be resolved", () => Promise.defer().promise);
   OS.File.getCurrentDirectory();
 
   Services.obs.notifyObservers(null, "profile-before-change", null);
   dump("Waiting for crash\n");
 };
@@ -68,17 +98,32 @@ function after_osfile_crash_noerror(mdum
 // Test that AsyncShutdown + OS.File reports errors correctly, in a case in which
 // the latest operation failed
 
 function setup_osfile_crash_exn() {
   Components.utils.import("resource://gre/modules/Services.jsm", this);
   Components.utils.import("resource://gre/modules/osfile.jsm", this);
   Components.utils.import("resource://gre/modules/Promise.jsm", this);
 
-  Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 1);
+  // For Windows XP and Vista we use toolkit.asyncshutdown.crash_timeout_winxp
+  // See bug 1248358.
+  var crash_timeout_pref = "toolkit.asyncshutdown.crash_timeout";
+  var os = Components.classes["@mozilla.org/xre/app-info;1"]
+             .getService(Components.interfaces.nsIXULRuntime).OS;
+  if (os == "Windows") {
+    var version = Components.classes["@mozilla.org/system-info;1"]
+                    .getService(Components.interfaces.nsIPropertyBag2)
+                    .getProperty("version");
+    if (parseFloat(version) < 6.1) {
+      // Less than Win7.
+      crash_timeout_pref = "toolkit.asyncshutdown.crash_timeout_winxp";
+    }
+  }
+  Services.prefs.setIntPref(crash_timeout_pref, 1);
+
   Services.prefs.setBoolPref("toolkit.osfile.native", false);
 
   OS.File.profileBeforeChange.addBlocker("Adding a blocker that will never be resolved", () => Promise.defer().promise);
   OS.File.read("I do not exist");
 
   Services.obs.notifyObservers(null, "profile-before-change", null);
   dump("Waiting for crash\n");
 };
--- a/toolkit/crashreporter/test/unit/test_crash_terminator.js
+++ b/toolkit/crashreporter/test/unit/test_crash_terminator.js
@@ -4,17 +4,32 @@
 "use strict";
 
 // Test that the Shutdown Terminator report errors correctly
 
 function setup_crash() {
   Components.utils.import("resource://gre/modules/Services.jsm");
 
   Services.prefs.setBoolPref("toolkit.terminator.testing", true);
-  Services.prefs.setIntPref("toolkit.asyncshutdown.crash_timeout", 10);
+
+  // For Windows XP and Vista we use toolkit.asyncshutdown.crash_timeout_winxp
+  // See bug 1248358.
+  var crashTimeoutPref = "toolkit.asyncshutdown.crash_timeout";
+  var os = Components.classes["@mozilla.org/xre/app-info;1"]
+             .getService(Components.interfaces.nsIXULRuntime).OS;
+  if (os == "Windows") {
+    var version = Components.classes["@mozilla.org/system-info;1"]
+                    .getService(Components.interfaces.nsIPropertyBag2)
+                    .getProperty("version");
+    if (parseFloat(version) < 6.1) {
+      // Less than Win7.
+      crashTimeoutPref = "toolkit.asyncshutdown.crash_timeout_winxp";
+    }
+  }
+  Services.prefs.setIntPref(crashTimeoutPref, 10);
 
   // Initialize the terminator
   // (normally, this is done through the manifest file, but xpcshell
   // doesn't take them into account).
   let terminator = Components.classes["@mozilla.org/toolkit/shutdown-terminator;1"].
     createInstance(Components.interfaces.nsIObserver);
   terminator.observe(null, "profile-after-change", null);