Bug 1366394 - Bump the Safe Browsing update timeout to 15s. r?hchang draft
authorFrancois Marier <francois@mozilla.com>
Fri, 19 May 2017 14:25:11 -0700
changeset 581423 44b307fbecded89d046ce0c7c7f8f69140b99cd1
parent 581334 c800b6dfca673f8cb0f3cf41e4f495755d04bbb3
child 629584 543d5b72f95eb71399220bd47483b946f2ab4872
push id59876
push userfmarier@mozilla.com
push dateFri, 19 May 2017 21:25:27 +0000
reviewershchang
bugs1366394, 1336904
milestone55.0a1
Bug 1366394 - Bump the Safe Browsing update timeout to 15s. r?hchang Based on the telemetry that landed as part of bug 1336904, Safe Browsing updates are failing too often: https://mzl.la/2qGkOPS This should enable browsers on slower networks to reach the update servers while still putting a reasonable bound on how long the update thread can be blocked. MozReview-Commit-ID: 6puVtpMT87K
modules/libpref/init/all.js
toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5238,17 +5238,17 @@ pref("urlclassifier.trackingTable", "tes
 pref("urlclassifier.trackingWhitelistTable", "test-trackwhite-simple,mozstd-trackwhite-digest256");
 
 // The number of random entries to send with a gethash request.
 pref("urlclassifier.gethashnoise", 4);
 
 // Gethash timeout for Safebrowsing.
 pref("urlclassifier.gethash.timeout_ms", 5000);
 // Update server response timeout for Safebrowsing.
-pref("urlclassifier.update.response_timeout_ms", 5000);
+pref("urlclassifier.update.response_timeout_ms", 15000);
 // Download update timeout for Safebrowsing.
 pref("urlclassifier.update.timeout_ms", 60000);
 
 // Name of the about: page contributed by safebrowsing to handle display of error
 // pages on phishing/malware hits.  (bug 399233)
 pref("urlclassifier.alternate_error_page", "blocked");
 
 // Enable phishing protection
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
@@ -24,24 +24,24 @@
 #include "mozilla/Telemetry.h"
 #include "nsContentUtils.h"
 #include "nsIURLFormatter.h"
 #include "Classifier.h"
 #include "SBTelemetryUtils.h"
 
 using namespace mozilla::safebrowsing;
 
-#define DEFAULT_RESPONSE_TIMEOUT 5 * 1000
+#define DEFAULT_RESPONSE_TIMEOUT_MS 15 * 1000
 #define DEFAULT_TIMEOUT_MS 60 * 1000
-static_assert(DEFAULT_TIMEOUT_MS > DEFAULT_RESPONSE_TIMEOUT,
+static_assert(DEFAULT_TIMEOUT_MS > DEFAULT_RESPONSE_TIMEOUT_MS,
   "General timeout must be greater than reponse timeout");
 
 static const char* gQuitApplicationMessage = "quit-application";
 
-static uint32_t sResponseTimeoutMs = DEFAULT_RESPONSE_TIMEOUT;
+static uint32_t sResponseTimeoutMs = DEFAULT_RESPONSE_TIMEOUT_MS;
 static uint32_t sTimeoutMs = DEFAULT_TIMEOUT_MS;
 
 // Limit the list file size to 32mb
 const uint32_t MAX_FILE_SIZE = (32 * 1024 * 1024);
 
 // Retry delay when we failed to DownloadUpdate() if due to
 // DBService busy.
 const uint32_t FETCH_NEXT_REQUEST_RETRY_DELAY_MS = 1000;
@@ -204,17 +204,17 @@ nsUrlClassifierStreamUpdater::FetchUpdat
   static bool preferencesInitialized = false;
 
   if (!preferencesInitialized) {
     mozilla::Preferences::AddUintVarCache(&sTimeoutMs,
                                           "urlclassifier.update.timeout_ms",
                                           DEFAULT_TIMEOUT_MS);
     mozilla::Preferences::AddUintVarCache(&sResponseTimeoutMs,
                                           "urlclassifier.update.response_timeout_ms",
-                                          DEFAULT_RESPONSE_TIMEOUT);
+                                          DEFAULT_RESPONSE_TIMEOUT_MS);
     preferencesInitialized = true;
   }
 
   if (sResponseTimeoutMs > sTimeoutMs) {
     NS_WARNING("Safe Browsing response timeout is greater than the general "
       "timeout. Disabling these update timeouts.");
     return NS_OK;
   }