Skip to content

Commit ff75ebb

Browse files
committed
http2: add checks to update the pending list if stream received is in scope
1 parent 3e6d717 commit ff75ebb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/node_http2.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2202,11 +2202,18 @@ void Http2Stream::SubmitRstStream(const uint32_t code) {
22022202
// the pending data when it is safe to do so. This is to avoid
22032203
// double free error due to unwanted behavior of nghttp2.
22042204
// Ref:https://github.com/nodejs/node/issues/38964
2205-
if (!is_writable() && is_reading()) {
2205+
2206+
// Add stream to the pending list if it is received with scope
2207+
// below in the stack. The pending list may not get processed
2208+
// if RST_STREAM received is not in scope and added to the list
2209+
// causing endpoint to hang.
2210+
if (session_->is_in_scope() &&
2211+
!is_writable() && is_reading()) {
22062212
session_->AddPendingRstStream(id_);
22072213
return;
22082214
}
22092215

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

0 commit comments

Comments
 (0)