Skip to content

Commit

Permalink
http2: add checks to update the pending list if stream received is in…
Browse files Browse the repository at this point in the history
… scope
  • Loading branch information
kumarak committed Jul 19, 2021
1 parent 3e6d717 commit ff75ebb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2202,11 +2202,18 @@ void Http2Stream::SubmitRstStream(const uint32_t code) {
// the pending data when it is safe to do so. This is to avoid
// double free error due to unwanted behavior of nghttp2.
// Ref:https://github.com/nodejs/node/issues/38964
if (!is_writable() && is_reading()) {

// Add stream to the pending list if it is received with scope
// below in the stack. The pending list may not get processed
// if RST_STREAM received is not in scope and added to the list
// causing endpoint to hang.
if (session_->is_in_scope() &&
!is_writable() && is_reading()) {
session_->AddPendingRstStream(id_);
return;
}


// If possible, force a purge of any currently pending data here to make sure
// it is sent before closing the stream. If it returns non-zero then we need
// to wait until the current write finishes and try again to avoid nghttp2
Expand Down

0 comments on commit ff75ebb

Please sign in to comment.