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
--- 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;
}