bug 1003935 - call dontreuse() on reclaimed conns with transaction refs r=sworkman
authorPatrick McManus <mcmanus@ducksong.com>
Wed, 30 Apr 2014 13:15:46 -0400
changeset 181037 b227a707080f920be035a3be01af406c131e75ed
parent 181036 95613a41c9de67c30e60decb233df3ffdb625dec
child 181153 51bc58066ac9fd0897374dbcea763a43303bfc18
push id26692
push usermcmanus@ducksong.com
push dateWed, 30 Apr 2014 21:37:56 +0000
treeherdermozilla-central@b227a707080f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssworkman
bugs1003935
milestone32.0a1
first release with
nightly linux32
b227a707080f / 32.0a1 / 20140501030202 / files
nightly linux64
b227a707080f / 32.0a1 / 20140501030202 / files
nightly mac
b227a707080f / 32.0a1 / 20140501030202 / files
nightly win32
b227a707080f / 32.0a1 / 20140501030202 / files
nightly win64
b227a707080f / 32.0a1 / 20140501030202 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1003935 - call dontreuse() on reclaimed conns with transaction refs r=sworkman
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpTransaction.cpp
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -2361,16 +2361,23 @@ nsHttpConnectionMgr::OnMsgReclaimConnect
             if (conn == ent->mYellowConnection)
                 ent->OnYellowComplete();
             nsHttpConnection *temp = conn;
             NS_RELEASE(temp);
             DecrementActiveConnCount(conn);
             ConditionallyStopTimeoutTick();
         }
 
+        // a connection that still holds a reference to a transaction was
+        // not closed naturally (i.e. it was reset or aborted) and is
+        // therefore not something that should be reused.
+        if (conn->Transaction()) {
+            conn->DontReuse();
+        }
+
         if (conn->CanReuse()) {
             LOG(("  adding connection to idle list\n"));
             // Keep The idle connection list sorted with the connections that
             // have moved the largest data pipelines at the front because these
             // connections have the largest cwnds on the server.
 
             // The linear search is ok here because the number of idleconns
             // in a single entry is generally limited to a small number (i.e. 6)
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -1061,17 +1061,20 @@ nsHttpTransaction::Restart()
 
     // rewind streams in case we already wrote out the request
     nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mRequestStream);
     if (seekable)
         seekable->Seek(nsISeekableStream::NS_SEEK_SET, 0);
 
     // clear old connection state...
     mSecurityInfo = 0;
-    NS_IF_RELEASE(mConnection);
+    if (mConnection) {
+        mConnection->DontReuse();
+        NS_RELEASE(mConnection);
+    }
 
     // disable pipelining for the next attempt in case pipelining caused the
     // reset.  this is being overly cautious since we don't know if pipelining
     // was the problem here.
     mCaps &= ~NS_HTTP_ALLOW_PIPELINING;
     SetPipelinePosition(0);
 
     return gHttpHandler->InitiateTransaction(this, mPriority);