From b5abaa573026d84808296b8a9c2a0e6803463d3b Mon Sep 17 00:00:00 2001 From: Alba Mendez Date: Sun, 26 May 2019 13:12:41 +0200 Subject: [PATCH 1/2] doc,test: clarify that Http2Stream is destroyed after data is read Correct docs to clarify that behaviour, and fix a race condition in test-http2-large-write-destroy.js. Fixes: https://github.com/nodejs/node/issues/27863 --- doc/api/http2.md | 5 +++-- test/parallel/test-http2-large-write-destroy.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 8176b83e9f308e..f5dea9640a4181 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -907,8 +907,9 @@ the value is `undefined`, the stream is not yet ready for use. All [`Http2Stream`][] instances are destroyed either when: -* An `RST_STREAM` frame for the stream is received by the connected peer. -* The `http2stream.close()` method is called. +* An `RST_STREAM` frame for the stream is received by the connected peer, + and pending data has been read. +* The `http2stream.close()` method is called, and pending data has been read. * The `http2stream.destroy()` or `http2session.destroy()` methods are called. When an `Http2Stream` instance is destroyed, an attempt will be made to send an diff --git a/test/parallel/test-http2-large-write-destroy.js b/test/parallel/test-http2-large-write-destroy.js index 24c0a055cc943f..9caf30caf3771c 100644 --- a/test/parallel/test-http2-large-write-destroy.js +++ b/test/parallel/test-http2-large-write-destroy.js @@ -32,6 +32,7 @@ server.listen(0, common.mustCall(() => { const req = client.request({ ':path': '/' }); req.end(); + req.resume(); // Otherwise close won't be emitted if there's pending data req.on('close', common.mustCall(() => { client.close(); From 088ed66082753d31bf9697510bd9a6795f278e79 Mon Sep 17 00:00:00 2001 From: Alba Mendez Date: Mon, 27 May 2019 08:22:56 +0200 Subject: [PATCH 2/2] Update test/parallel/test-http2-large-write-destroy.js Co-Authored-By: Luigi Pinca --- test/parallel/test-http2-large-write-destroy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-http2-large-write-destroy.js b/test/parallel/test-http2-large-write-destroy.js index 9caf30caf3771c..b59c66bb04755b 100644 --- a/test/parallel/test-http2-large-write-destroy.js +++ b/test/parallel/test-http2-large-write-destroy.js @@ -32,7 +32,7 @@ server.listen(0, common.mustCall(() => { const req = client.request({ ':path': '/' }); req.end(); - req.resume(); // Otherwise close won't be emitted if there's pending data + req.resume(); // Otherwise close won't be emitted if there's pending data. req.on('close', common.mustCall(() => { client.close();