From 8bac2262189ff9e404c459ecdb32bbe0ca6ae75e Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Tue, 8 Nov 2011 11:56:46 +0100 Subject: [PATCH] Bug 700402 - ABORT: syntimer not null, creting SYN retry timer after connection manager shutdown, r=mcmanus --- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 9db00f806fb1..23ef89334e37 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -1491,6 +1491,9 @@ nsHttpConnectionMgr::nsHalfOpenSocket::Abandon() { LOG(("nsHalfOpenSocket::Abandon [this=%p ent=%s]", this, mEnt->mConnInfo->Host())); + + NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); + nsRefPtr deleteProtector(this); if (mStreamOut) { @@ -1627,8 +1630,14 @@ nsHttpConnectionMgr::nsHalfOpenSocket::OnTransportStatus(nsITransport *trans, switch (status) { case nsISocketTransport::STATUS_CONNECTING_TO: // Passed DNS resolution, now trying to connect, start the backup timer - // only prevent creating another backup transport - if (!mBackupTransport && !mSynTimer) + // only prevent creating another backup transport. + // We also check for mEnt presence to not instantiate the timer after + // this half open socket has already been abandoned. It may happen + // when we get this notification right between main-thread calls to + // nsHttpConnectionMgr::Shutdown and nsSocketTransportService::Shutdown + // where the first abandones all half open socket instances and only + // after that the second stops the socket thread. + if (mEnt && !mBackupTransport && !mSynTimer) SetupBackupTimer(); break;