Bug 1580740 - Don't use TRR when calling nsDNSService::DeprecatedSyncResolve on the main thread r=dragana

`nsAuthSSPI` makes a call to `DeprecatedSyncResolve` that normally issues a DNS
request and blocks until that completes. Apart from being a problem in general
this is an issue when using TRR, because the HTTPS channel to the DoH server
uses the main thread. When `DeprecatedSyncResolve` gets called on the main
thread it then blocks the thread, and since the TRR request never has the
chance to complete (even the TRR cancellation when the timer expires is
processed on the main thread) the result is a deadlock.

This structural problem should be fixed, but until that happens we should
set the `RESOLVE_DISABLE_TRR` flag when calling `ResolveHost` from
`nsDNSService::DeprecatedSyncResolve`

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Valentin Gosu 2019-12-16 12:33:57 +00:00
parent 9397b8fe62
commit 2808b0a1c5

View File

@ -1078,6 +1078,14 @@ nsresult nsDNSService::ResolveInternal(
uint16_t af = GetAFForLookup(hostname, flags);
// TRR uses the main thread for the HTTPS channel to the DoH server.
// If this were to block the main thread while waiting for TRR it would
// likely cause a deadlock. Instead we intentionally choose to not use TRR
// for this.
if (NS_IsMainThread()) {
flags |= RESOLVE_DISABLE_TRR;
}
rv = res->ResolveHost(hostname, RESOLVE_TYPE_DEFAULT, aOriginAttributes,
flags, af, syncReq);
if (NS_SUCCEEDED(rv)) {