Backed out changeset 9ccaad4630db (bug 1816677) for causing DNS related crashes (bug 1837252). a=backout

This commit is contained in:
Butkovits Atila 2023-06-09 12:33:06 +03:00
parent a5ea88ae3e
commit 7d7bba388d
9 changed files with 3 additions and 122 deletions

View File

@ -12526,12 +12526,6 @@
value: false
mirror: always
# When a Http/3 connection failed, whether to retry with a different IP address.
- name: network.http.http3.retry_different_ip_family
type: RelaxedAtomicBool
value: true
mirror: always
# When true, a http request will be upgraded to https when HTTPS RR is
# available.
- name: network.dns.upgrade_with_https_rr

View File

@ -1004,53 +1004,5 @@ nsresult ConnectionEntry::CreateDnsAndConnectSocket(
return NS_OK;
}
bool ConnectionEntry::AllowToRetryDifferentIPFamilyForHttp3(nsresult aError) {
LOG(
("ConnectionEntry::AllowToRetryDifferentIPFamilyForHttp3 %p "
"error=%" PRIx32,
this, static_cast<uint32_t>(aError)));
if (!IsHttp3()) {
MOZ_ASSERT(false, "Should not be called for non Http/3 connection");
return false;
}
if (!StaticPrefs::network_http_http3_retry_different_ip_family()) {
return false;
}
// Only allow to retry with these two errors.
if (aError != NS_ERROR_CONNECTION_REFUSED &&
aError != NS_ERROR_PROXY_CONNECTION_REFUSED) {
return false;
}
// Already retried once.
if (mRetriedDifferentIPFamilyForHttp3) {
return false;
}
return true;
}
void ConnectionEntry::SetRetryDifferentIPFamilyForHttp3(uint16_t aIPFamily) {
LOG(("ConnectionEntry::SetRetryDifferentIPFamilyForHttp3 %p, af=%u", this,
aIPFamily));
mPreferIPv4 = false;
mPreferIPv6 = false;
if (aIPFamily == AF_INET) {
mPreferIPv6 = true;
}
if (aIPFamily == AF_INET6) {
mPreferIPv4 = true;
}
LOG((" %p prefer ipv4=%d, ipv6=%d", this, (bool)mPreferIPv4,
(bool)mPreferIPv6));
MOZ_DIAGNOSTIC_ASSERT(mPreferIPv4 ^ mPreferIPv6);
}
} // namespace net
} // namespace mozilla

View File

@ -195,9 +195,6 @@ class ConnectionEntry {
void MaybeUpdateEchConfig(nsHttpConnectionInfo* aConnInfo);
bool AllowToRetryDifferentIPFamilyForHttp3(nsresult aError);
void SetRetryDifferentIPFamilyForHttp3(uint16_t aIPFamily);
private:
void InsertIntoIdleConnections_internal(nsHttpConnection* conn);
void RemoveFromIdleConnectionsIndex(size_t inx);
@ -214,8 +211,6 @@ class ConnectionEntry {
PendingTransactionQueue mPendingQ;
~ConnectionEntry();
bool mRetriedDifferentIPFamilyForHttp3 = false;
};
} // namespace net

View File

@ -230,18 +230,11 @@ void Http3Session::Shutdown() {
bool isEchRetry = mError == mozilla::psm::GetXPCOMFromNSSError(
SSL_ERROR_ECH_RETRY_WITH_ECH);
bool allowToRetryWithDifferentIPFamily =
mBeforeConnectedError &&
gHttpHandler->ConnMgr()->AllowToRetryDifferentIPFamilyForHttp3(mConnInfo,
mError);
LOG(("Http3Session::Shutdown %p allowToRetryWithDifferentIPFamily=%d", this,
allowToRetryWithDifferentIPFamily));
if ((mBeforeConnectedError ||
(mError == NS_ERROR_NET_HTTP3_PROTOCOL_ERROR)) &&
(mError !=
mozilla::psm::GetXPCOMFromNSSError(SSL_ERROR_BAD_CERT_DOMAIN)) &&
!isEchRetry && !mConnInfo->GetWebTransport() &&
!allowToRetryWithDifferentIPFamily && !mDontExclude) {
!isEchRetry && !mConnInfo->GetWebTransport()) {
gHttpHandler->ExcludeHttp3(mConnInfo);
}
@ -256,28 +249,7 @@ void Http3Session::Shutdown() {
// transaction will be restarted with a new echConfig.
stream->Close(mError);
} else {
if (allowToRetryWithDifferentIPFamily && mNetAddr) {
NetAddr addr;
mNetAddr->GetNetAddr(&addr);
gHttpHandler->ConnMgr()->SetRetryDifferentIPFamilyForHttp3(
mConnInfo, addr.raw.family);
nsHttpTransaction* trans =
stream->Transaction()->QueryHttpTransaction();
if (trans) {
// This is a bit hacky. We redispatch the transaction here to avoid
// touching the complicated retry logic in nsHttpTransaction.
trans->RemoveConnection();
Unused << gHttpHandler->InitiateTransaction(trans,
trans->Priority());
} else {
stream->Close(NS_ERROR_NET_RESET);
}
// Since Http3Session::Shutdown can be called multiple times, we set
// mDontExclude for not putting this domain into the excluded list.
mDontExclude = true;
} else {
stream->Close(NS_ERROR_NET_RESET);
}
stream->Close(NS_ERROR_NET_RESET);
}
} else if (!stream->HasStreamId()) {
if (NS_SUCCEEDED(mError)) {

View File

@ -370,8 +370,6 @@ class Http3Session final : public nsAHttpTransaction, public nsAHttpConnection {
nsTArray<RefPtr<Http3StreamBase>> mWebTransportStreams;
bool mHasWebTransportSession = false;
// When true, we don't add this connection info into the Http/3 excluded list.
bool mDontExclude = false;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Http3Session, NS_HTTP3SESSION_IID);

View File

@ -3818,24 +3818,4 @@ void nsHttpConnectionMgr::CheckTransInPendingQueue(nsHttpTransaction* aTrans) {
#endif
}
bool nsHttpConnectionMgr::AllowToRetryDifferentIPFamilyForHttp3(
nsHttpConnectionInfo* ci, nsresult aError) {
ConnectionEntry* ent = mCT.GetWeak(ci->HashKey());
if (!ent) {
return false;
}
return ent->AllowToRetryDifferentIPFamilyForHttp3(aError);
}
void nsHttpConnectionMgr::SetRetryDifferentIPFamilyForHttp3(
nsHttpConnectionInfo* ci, uint16_t aIPFamily) {
ConnectionEntry* ent = mCT.GetWeak(ci->HashKey());
if (!ent) {
return;
}
ent->SetRetryDifferentIPFamilyForHttp3(aIPFamily);
}
} // namespace mozilla::net

View File

@ -191,11 +191,6 @@ class nsHttpConnectionMgr final : public HttpConnectionMgrShell,
// connection
bool BeConservativeIfProxied(nsIProxyInfo* proxy);
bool AllowToRetryDifferentIPFamilyForHttp3(nsHttpConnectionInfo* ci,
nsresult aError);
void SetRetryDifferentIPFamilyForHttp3(nsHttpConnectionInfo* ci,
uint16_t aIPFamily);
protected:
friend class ConnectionEntry;
void IncrementActiveConnCount();

View File

@ -3534,9 +3534,4 @@ void nsHttpTransaction::SetIsForWebTransport(bool aIsForWebTransport) {
mIsForWebTransport = aIsForWebTransport;
}
void nsHttpTransaction::RemoveConnection() {
MutexAutoLock lock(mLock);
mConnection = nullptr;
}
} // namespace mozilla::net

View File

@ -88,7 +88,7 @@ class nsHttpTransaction final : public nsAHttpTransaction,
void MakeNonSticky() override { mCaps &= ~NS_HTTP_STICKY_CONNECTION; }
void MakeRestartable() override { mCaps |= NS_HTTP_CONNECTION_RESTARTABLE; }
void MakeNonRestartable() { mCaps &= ~NS_HTTP_CONNECTION_RESTARTABLE; }
void RemoveConnection();
void SetIsHttp2Websocket(bool h2ws) override { mIsHttp2Websocket = h2ws; }
bool IsHttp2Websocket() override { return mIsHttp2Websocket; }