Bug 1498942 - Lengthen timeouts for detecting hung content processes during shutdown r=Ehsan a=jcristau
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 06 Nov 2018 13:51:21 +0000
changeset 501070 0b925d9a30ccb4e020f4dc8ef5a7d24e2b5dcbfa
parent 501069 7943fd2406300abe14a6aedbae8eb5c1d988443e
child 501071 0c7a40a87b9a29236ac5fc30bad547177591cbb8
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, jcristau
bugs1498942
milestone64.0
Bug 1498942 - Lengthen timeouts for detecting hung content processes during shutdown r=Ehsan a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D10621
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -3095,17 +3095,17 @@ ContentChild::RecvDomainSetChanged(const
 
 void
 ContentChild::StartForceKillTimer()
 {
   if (mForceKillTimer) {
     return;
   }
 
-  int32_t timeoutSecs = Preferences::GetInt("dom.ipc.tabs.shutdownTimeoutSecs", 5);
+  int32_t timeoutSecs = StaticPrefs::dom_ipc_tabs_shutdownTimeoutSecs();
   if (timeoutSecs > 0) {
     NS_NewTimerWithFuncCallback(getter_AddRefs(mForceKillTimer),
                                 ContentChild::ForceKillTimerCallback,
                                 this,
                                 timeoutSecs * 1000,
                                 nsITimer::TYPE_ONE_SHOT,
                                 "dom::ContentChild::StartForceKillTimer");
     MOZ_ASSERT(mForceKillTimer);
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1995,17 +1995,17 @@ ContentParent::NotifyTabDestroying(const
 
 void
 ContentParent::StartForceKillTimer()
 {
   if (mForceKillTimer || !mIPCOpen) {
     return;
   }
 
-  int32_t timeoutSecs = Preferences::GetInt("dom.ipc.tabs.shutdownTimeoutSecs", 5);
+  int32_t timeoutSecs = StaticPrefs::dom_ipc_tabs_shutdownTimeoutSecs();
   if (timeoutSecs > 0) {
     NS_NewTimerWithFuncCallback(getter_AddRefs(mForceKillTimer),
                                 ContentParent::ForceKillTimerCallback,
                                 this,
                                 timeoutSecs * 1000,
                                 nsITimer::TYPE_ONE_SHOT,
                                 "dom::ContentParent::StartForceKillTimer");
     MOZ_ASSERT(mForceKillTimer);
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -174,16 +174,32 @@ VARCACHE_PREF(
 #endif
 VARCACHE_PREF(
   "dom.animations-api.timelines.enabled",
    dom_animations_api_timelines_enabled,
   bool, PREF_VALUE
 )
 #undef PREF_VALUE
 
+// How long a content process can take before closing its IPC channel
+// after shutdown is initiated.  If the process exceeds the timeout,
+// we fear the worst and kill it.
+#if !defined(DEBUG) && !defined(MOZ_ASAN) && !defined(MOZ_VALGRIND) && \
+    !defined(MOZ_TSAN)
+# define PREF_VALUE 10
+#else
+# define PREF_VALUE 0
+#endif
+VARCACHE_PREF(
+  "dom.ipc.tabs.shutdownTimeoutSecs",
+   dom_ipc_tabs_shutdownTimeoutSecs,
+  RelaxedAtomicUint32, PREF_VALUE
+)
+#undef PREF_VALUE
+
 // If this is true, "keypress" event's keyCode value and charCode value always
 // become same if the event is not created/initialized by JS.
 VARCACHE_PREF(
   "dom.keyboardevent.keypress.set_keycode_and_charcode_to_same_value",
    dom_keyboardevent_keypress_set_keycode_and_charcode_to_same_value,
   bool, false
 )
 
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3246,31 +3246,26 @@ pref("dom.ipc.plugins.contentTimeoutSecs
 pref("dom.ipc.plugins.processLaunchTimeoutSecs", 45);
 #ifdef XP_WIN
 // How long a plugin is allowed to process a synchronous IPC message
 // before we display the plugin hang UI
 pref("dom.ipc.plugins.hangUITimeoutSecs", 11);
 // Minimum time that the plugin hang UI will be displayed
 pref("dom.ipc.plugins.hangUIMinDisplaySecs", 10);
 #endif
-// How long a content process can take before closing its IPC channel
-// after shutdown is initiated.  If the process exceeds the timeout,
-// we fear the worst and kill it.
-pref("dom.ipc.tabs.shutdownTimeoutSecs", 5);
 #else
 // No timeout in leak-checking builds
 pref("dom.ipc.plugins.timeoutSecs", 0);
 pref("dom.ipc.plugins.contentTimeoutSecs", 0);
 pref("dom.ipc.plugins.processLaunchTimeoutSecs", 0);
 pref("dom.ipc.plugins.parentTimeoutSecs", 0);
 #ifdef XP_WIN
 pref("dom.ipc.plugins.hangUITimeoutSecs", 0);
 pref("dom.ipc.plugins.hangUIMinDisplaySecs", 0);
 #endif
-pref("dom.ipc.tabs.shutdownTimeoutSecs", 0);
 #endif
 
 pref("dom.ipc.plugins.flash.disable-protected-mode", false);
 
 pref("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", true);
 pref("dom.ipc.plugins.reportCrashURL", true);
 
 // How long we wait before unloading an idle plugin process.