Bug 1542384 - reduce timeout of shutdown resolver threads and make it prefable r=valentin

Differential Revision: https://phabricator.services.mozilla.com/D27013

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Junior Hsu 2019-04-12 17:04:05 +00:00
Родитель 9782f68abf
Коммит 598c828aa6
2 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -2071,6 +2071,13 @@ VARCACHE_PREF(
uint32_t, 0
)
// Max time to shutdown the resolver threads
VARCACHE_PREF(
"network.dns.resolver_shutdown_timeout_ms",
network_dns_resolver_shutdown_timeout_ms,
uint32_t, 2000
)
//---------------------------------------------------------------------------
// ContentSessionStore prefs
//---------------------------------------------------------------------------

Просмотреть файл

@ -44,6 +44,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs.h"
using namespace mozilla;
using namespace mozilla::net;
@ -799,9 +800,10 @@ void nsHostResolver::Shutdown() {
pendingQLow.clear();
evictionQ.clear();
// Shutdown the resolver threads, but with a timeout of 20 seconds.
// Shutdown the resolver threads, but with a timeout of 2 seconds (prefable).
// If the timeout is exceeded, any stuck threads will be leaked.
mResolverThreads->ShutdownWithTimeout(20 * 1000);
mResolverThreads->ShutdownWithTimeout(
StaticPrefs::network_dns_resolver_shutdown_timeout_ms());
{
mozilla::DebugOnly<nsresult> rv = GetAddrInfoShutdown();