Skip to content

TS-4916 Add safety net to avoid H2-infinite-loop deadlock.#1117

Merged
zwoop merged 1 commit intoapache:masterfrom
gtenev:TS-4916-master
Oct 19, 2016
Merged

TS-4916 Add safety net to avoid H2-infinite-loop deadlock.#1117
zwoop merged 1 commit intoapache:masterfrom
gtenev:TS-4916-master

Conversation

@gtenev
Copy link
Contributor

@gtenev gtenev commented Oct 18, 2016

Current Http2ConnectionState implementation uses a memory pool for
instantiating streams and DLL<> stream_list for storing active streams.
Destroying a stream before deleting it from stream_list and then creating
a new one + reusing the same chunk from the memory pool right away always
leads to destroying the DLL structure (deadlocks, inconsistencies).
Added a safety net since the consequences are disastrous.
Until the design/implementation changes it seems less error prone
to (double) delete before destroying (noop if already deleted).

@atsci
Copy link

atsci commented Oct 18, 2016

Linux build failed! See https://ci.trafficserver.apache.org/job/Github-Linux/932/ for details.

@bryancall
Copy link
Contributor

👍 - Looks good

// less error prone to (double) delete before destroying (noop if already deleted).
if (parent) {
static_cast<Http2ClientSession *>(parent)->connection_state.delete_stream(this);
Warning("Http2Stream was about to be deallocated without removing it from the active stream list");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are sure this is not going to produce a lot of warnings, right ? :)

Copy link
Contributor Author

@gtenev gtenev Oct 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the streams are removed properly from the active stream list before this catch-all-delete-stream call and freeing the stream's memory we should not see this at all.

With the current 6.2.1 code it took 1-3 days for this to occur so even if the problem persists (not deleting the streams on time) it seems reasonable to believe we would see the warning with similar frequency (once in 1-3 days).

@atsci
Copy link

atsci commented Oct 18, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/1041/ for details.

@zwoop
Copy link
Contributor

zwoop commented Oct 18, 2016

Sigh, it failed again on the bison generated files :-/. [approve ci].

@zwoop zwoop added the HTTP/2 label Oct 18, 2016
@zwoop zwoop added this to the 7.1.0 milestone Oct 18, 2016
@atsci
Copy link

atsci commented Oct 18, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/1048/ for details.

@atsci
Copy link

atsci commented Oct 18, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/940/ for details.

Current Http2ConnectionState implementation uses a memory pool for
instantiating streams and DLL<> stream_list for storing active streams.
Destroying a stream before deleting it from stream_list and then creating
a new one + reusing the same chunk from the memory pool right away always
leads to destroying the DLL structure (deadlocks, inconsistencies).
Added a safety net since the consequences are disastrous.
Until the design/implementation changes it seems less error prone
to (double) delete before destroying (noop if already deleted).
@shinrich
Copy link
Member

Looks good to me as well.

@atsci
Copy link

atsci commented Oct 18, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/1050/ for details.

@atsci
Copy link

atsci commented Oct 18, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/942/ for details.

@zwoop zwoop merged commit a6f9337 into apache:master Oct 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants