From 3c8c53f4f4c35e87f73e9fdf472f06fd94f77f68 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Thu, 31 May 2018 10:39:19 +0200 Subject: [PATCH] http2: fix premature destroy Check stream._writableState.finished instead of stream.writable as the latter can lead to premature calls to destroy and dropped writes on busy processes. Backport-PR-URL: https://github.com/nodejs/node/pull/22850 PR-URL: https://github.com/nodejs/node/pull/21051 Fixes: https://github.com/nodejs/node/issues/20750 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- lib/internal/http2/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 39430edee6ff4f..8f6c0c20b5b36c 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1892,7 +1892,7 @@ class Http2Stream extends Duplex { } // TODO(mcollina): remove usage of _*State properties - if (!this.writable) { + if (this._writableState.finished) { if (!this.readable && this.closed) { this.destroy(); return;