File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2196,11 +2196,13 @@ void Http2Stream::SubmitRstStream(const uint32_t code) {
2196
2196
CHECK (!this ->is_destroyed ());
2197
2197
code_ = code;
2198
2198
2199
- // If RST_STREAM is submitted with the cancel code, don't force purge the
2200
- // currently sending data. Instead add it to the pending stream list to
2201
- // avoid prioritizing over other operations.
2199
+ // If RST_STREAM frame is received and stream is not writable
2200
+ // because it is busy reading data, don't try force purging it.
2201
+ // Instead add the stream to pending stream list and process
2202
+ // the pending data when it is safe to do so. This is to avoid
2203
+ // double free error due to unwanted behavior of nghttp2.
2202
2204
// Ref:https://github.com/nodejs/node/issues/38964
2203
- if (code_ == NGHTTP2_CANCEL ) {
2205
+ if (! is_writable () && is_reading () ) {
2204
2206
session_->AddPendingRstStream (id_);
2205
2207
return ;
2206
2208
}
You can’t perform that action at this time.
0 commit comments