Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/dispatcher/client-h2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,13 @@ function onResponse (headers) {

// Due to the stream nature, it is possible we face a race condition
// where the stream has been assigned, but the request has been aborted
// the request remains in-flight and headers hasn't been received yet
// for those scenarios, best effort is to destroy the stream immediately
// as there's no value to keep it open.
if (request.aborted) {
// or already completed and headers hasn't been received yet. A late
// 'response' delivered after completion would call request.onResponseStart
// post-completion, tripping its `assert(!this.completed)` (an uncatchable
// throw on the http2 event tick). Guard `completed` here as onEnd/onTrailers
// already do; best effort is to release the stream immediately as there's
// no value to keep it open.
if (request.aborted || request.completed) {
releaseRequestStream(stream)
return
}
Expand Down