Skip to content

Commit

Permalink
Backout d0797dfcab56 (bug 819044) on suspicion of Linux32 mochitest-4…
Browse files Browse the repository at this point in the history
… leaks on a CLOSED TREE
  • Loading branch information
Ed Morley committed Dec 19, 2012
1 parent a3b7f64 commit c4a9312
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 129 deletions.
60 changes: 6 additions & 54 deletions netwerk/protocol/http/SpdySession2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,35 +92,16 @@ SpdySession2::ShutdownEnumerator(nsAHttpTransaction *key,

// On a clean server hangup the server sets the GoAwayID to be the ID of
// the last transaction it processed. If the ID of stream in the
// local stream is greater than that it can safely be restarted because the
// server guarantees it was not partially processed. Streams that have not
// registered an ID haven't actually been sent yet so they can always be
// restarted.
if (self->mCleanShutdown &&
(stream->StreamID() > self->mGoAwayID || !stream->HasRegisteredID()))
// local session is greater than that it can safely be restarted because the
// server guarantees it was not partially processed.
if (self->mCleanShutdown && (stream->StreamID() > self->mGoAwayID))
self->CloseStream(stream, NS_ERROR_NET_RESET); // can be restarted
else
self->CloseStream(stream, NS_ERROR_ABORT);

return PL_DHASH_NEXT;
}

PLDHashOperator
SpdySession2::GoAwayEnumerator(nsAHttpTransaction *key,
nsAutoPtr<SpdyStream2> &stream,
void *closure)
{
SpdySession2 *self = static_cast<SpdySession2 *>(closure);

// these streams were not processed by the server and can be restarted.
// Do that after the enumerator completes to avoid the risk of
// a restart event re-entrantly modifying this hash.
if (stream->StreamID() > self->mGoAwayID || !stream->HasRegisteredID())
self->mGoAwayStreamsToRestart.Push(stream);

return PL_DHASH_NEXT;
}

SpdySession2::~SpdySession2()
{
LOG3(("SpdySession2::~SpdySession2 %p mDownstreamState=%X",
Expand Down Expand Up @@ -1344,38 +1325,9 @@ SpdySession2::HandleGoAway(SpdySession2 *self)
self->mGoAwayID =
PR_ntohl(reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get())[2]);
self->mCleanShutdown = true;

// Find streams greater than the last-good ID and mark them for deletion
// in the mGoAwayStreamsToRestart queue with the GoAwayEnumerator. They can
// be restarted.
self->mStreamTransactionHash.Enumerate(GoAwayEnumerator, self);

// Process the streams marked for deletion and restart.
uint32_t size = self->mGoAwayStreamsToRestart.GetSize();
for (uint32_t count = 0; count < size; ++count) {
SpdyStream2 *stream =
static_cast<SpdyStream2 *>(self->mGoAwayStreamsToRestart.PopFront());

self->CloseStream(stream, NS_ERROR_NET_RESET);
if (stream->HasRegisteredID())
self->mStreamIDHash.Remove(stream->StreamID());
self->mStreamTransactionHash.Remove(stream->Transaction());
}

// Queued streams can also be deleted from this session and restarted
// in another one. (they were never sent on the network so they implicitly
// are not covered by the last-good id.
size = self->mQueuedStreams.GetSize();
for (uint32_t count = 0; count < size; ++count) {
SpdyStream2 *stream =
static_cast<SpdyStream2 *>(self->mQueuedStreams.PopFront());
self->CloseStream(stream, NS_ERROR_NET_RESET);
self->mStreamTransactionHash.Remove(stream->Transaction());
}

LOG3(("SpdySession2::HandleGoAway %p GOAWAY Last-Good-ID 0x%X."
"live streams=%d\n", self, self->mGoAwayID,
self->mStreamTransactionHash.Count()));

LOG3(("SpdySession2::HandleGoAway %p GOAWAY Last-Good-ID 0x%X.",
self, self->mGoAwayID));
self->ResumeRecv();
self->ResetDownstreamState();
return NS_OK;
Expand Down
7 changes: 0 additions & 7 deletions netwerk/protocol/http/SpdySession2.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ class SpdySession2 MOZ_FINAL : public ASpdySession
nsAutoPtr<SpdyStream2> &,
void *);

static PLDHashOperator GoAwayEnumerator(nsAHttpTransaction *,
nsAutoPtr<SpdyStream2> &,
void *);

// This is intended to be nsHttpConnectionMgr:nsHttpConnectionHandle taken
// from the first transaction on this session. That object contains the
// pointer to the real network-level nsHttpConnection object.
Expand Down Expand Up @@ -339,9 +335,6 @@ class SpdySession2 MOZ_FINAL : public ASpdySession
PRIntervalTime mLastDataReadEpoch; // used for IdleTime()
PRIntervalTime mPingSentEpoch;
uint32_t mNextPingID;

// used as a temporary buffer while enumerating the stream hash during GoAway
nsDeque mGoAwayStreamsToRestart;
};

}} // namespace mozilla::net
Expand Down
63 changes: 8 additions & 55 deletions netwerk/protocol/http/SpdySession3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,35 +93,16 @@ SpdySession3::ShutdownEnumerator(nsAHttpTransaction *key,

// On a clean server hangup the server sets the GoAwayID to be the ID of
// the last transaction it processed. If the ID of stream in the
// local stream is greater than that it can safely be restarted because the
// server guarantees it was not partially processed. Streams that have not
// registered an ID haven't actually been sent yet so they can always be
// restarted.
if (self->mCleanShutdown &&
(stream->StreamID() > self->mGoAwayID || !stream->HasRegisteredID()))
// local session is greater than that it can safely be restarted because the
// server guarantees it was not partially processed.
if (self->mCleanShutdown && (stream->StreamID() > self->mGoAwayID))
self->CloseStream(stream, NS_ERROR_NET_RESET); // can be restarted
else
self->CloseStream(stream, NS_ERROR_ABORT);

return PL_DHASH_NEXT;
}

PLDHashOperator
SpdySession3::GoAwayEnumerator(nsAHttpTransaction *key,
nsAutoPtr<SpdyStream3> &stream,
void *closure)
{
SpdySession3 *self = static_cast<SpdySession3 *>(closure);

// these streams were not processed by the server and can be restarted.
// Do that after the enumerator completes to avoid the risk of
// a restart event re-entrantly modifying this hash.
if (stream->StreamID() > self->mGoAwayID || !stream->HasRegisteredID())
self->mGoAwayStreamsToRestart.Push(stream);

return PL_DHASH_NEXT;
}

SpdySession3::~SpdySession3()
{
LOG3(("SpdySession3::~SpdySession3 %p mDownstreamState=%X",
Expand Down Expand Up @@ -320,6 +301,7 @@ SpdySession3::AddStream(nsAHttpTransaction *aHttpTransaction,
&mUpstreamZlib,
aPriority);


LOG3(("SpdySession3::AddStream session=%p stream=%p NextID=0x%X (tentative)",
this, stream, mNextStreamID));

Expand Down Expand Up @@ -1221,39 +1203,10 @@ SpdySession3::HandleGoAway(SpdySession3 *self)
self->mGoAwayID =
PR_ntohl(reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get())[2]);
self->mCleanShutdown = true;

// Find streams greater than the last-good ID and mark them for deletion
// in the mGoAwayStreamsToRestart queue with the GoAwayEnumerator. They can
// be restarted.
self->mStreamTransactionHash.Enumerate(GoAwayEnumerator, self);

// Process the streams marked for deletion and restart.
uint32_t size = self->mGoAwayStreamsToRestart.GetSize();
for (uint32_t count = 0; count < size; ++count) {
SpdyStream3 *stream =
static_cast<SpdyStream3 *>(self->mGoAwayStreamsToRestart.PopFront());

self->CloseStream(stream, NS_ERROR_NET_RESET);
if (stream->HasRegisteredID())
self->mStreamIDHash.Remove(stream->StreamID());
self->mStreamTransactionHash.Remove(stream->Transaction());
}

// Queued streams can also be deleted from this session and restarted
// in another one. (they were never sent on the network so they implicitly
// are not covered by the last-good id.
size = self->mQueuedStreams.GetSize();
for (uint32_t count = 0; count < size; ++count) {
SpdyStream3 *stream =
static_cast<SpdyStream3 *>(self->mQueuedStreams.PopFront());
self->CloseStream(stream, NS_ERROR_NET_RESET);
self->mStreamTransactionHash.Remove(stream->Transaction());
}

LOG3(("SpdySession3::HandleGoAway %p GOAWAY Last-Good-ID 0x%X status 0x%X "
"live streams=%d\n", self, self->mGoAwayID,
PR_ntohl(reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get())[3]),
self->mStreamTransactionHash.Count()));

LOG3(("SpdySession3::HandleGoAway %p GOAWAY Last-Good-ID 0x%X status 0x%X\n",
self, self->mGoAwayID,
PR_ntohl(reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get())[3])));

self->ResumeRecv();
self->ResetDownstreamState();
Expand Down
7 changes: 0 additions & 7 deletions netwerk/protocol/http/SpdySession3.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ class SpdySession3 MOZ_FINAL : public ASpdySession
nsAutoPtr<SpdyStream3> &,
void *);

static PLDHashOperator GoAwayEnumerator(nsAHttpTransaction *,
nsAutoPtr<SpdyStream3> &,
void *);

static PLDHashOperator UpdateServerRwinEnumerator(nsAHttpTransaction *,
nsAutoPtr<SpdyStream3> &,
void *);
Expand Down Expand Up @@ -350,9 +346,6 @@ class SpdySession3 MOZ_FINAL : public ASpdySession
PRIntervalTime mLastDataReadEpoch; // used for IdleTime()
PRIntervalTime mPingSentEpoch;
uint32_t mNextPingID;

// used as a temporary buffer while enumerating the stream hash during GoAway
nsDeque mGoAwayStreamsToRestart;
};

}} // namespace mozilla::net
Expand Down
4 changes: 1 addition & 3 deletions netwerk/protocol/http/SpdyStream2.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class SpdyStream2 MOZ_FINAL : public nsAHttpSegmentReader
mFullyOpen = 1;
}

bool HasRegisteredID() { return mStreamID != 0; }

nsAHttpTransaction *Transaction()
{
return mTransaction;
Expand Down Expand Up @@ -123,7 +121,7 @@ class SpdyStream2 MOZ_FINAL : public nsAHttpSegmentReader
// The quanta upstream data frames are chopped into
uint32_t mChunkSize;

// Flag is set when all http request headers have been read and ID is stable
// Flag is set when all http request headers have been read
uint32_t mSynFrameComplete : 1;

// Flag is set when the HTTP processor has more data to send
Expand Down
4 changes: 1 addition & 3 deletions netwerk/protocol/http/SpdyStream3.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class SpdyStream3 MOZ_FINAL : public nsAHttpSegmentReader
mFullyOpen = 1;
}

bool HasRegisteredID() { return mStreamID != 0; }

nsAHttpTransaction *Transaction()
{
return mTransaction;
Expand Down Expand Up @@ -145,7 +143,7 @@ class SpdyStream3 MOZ_FINAL : public nsAHttpSegmentReader
// The quanta upstream data frames are chopped into
uint32_t mChunkSize;

// Flag is set when all http request headers have been read and ID is stable
// Flag is set when all http request headers have been read
uint32_t mSynFrameComplete : 1;

// Flag is set when the HTTP processor has more data to send
Expand Down

0 comments on commit c4a9312

Please sign in to comment.