From 086bb2f8d45478d6c0a735ec2d12cb70572f2287 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 21 Feb 2023 04:46:21 -0800 Subject: [PATCH] Revert "src: let http2 streams end after session close" This reverts commit dee882e94f4caa4e1cd608013f90f6a14629403f. Moved the test that demonstrated what this commit was fixing to the `known_issues` folder. Fixes: https://github.com/nodejs/node/issues/46234 PR-URL: https://github.com/nodejs/node/pull/46721 Reviewed-By: Colin Ihrig Reviewed-By: Debadree Chatterjee Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau --- src/node_http2.cc | 11 ----------- .../test-http2-trailers-after-session-close.js | 9 +++++++-- 2 files changed, 7 insertions(+), 13 deletions(-) rename test/{parallel => known_issues}/test-http2-trailers-after-session-close.js (81%) diff --git a/src/node_http2.cc b/src/node_http2.cc index 42694cccdbe1d7..53216dcee8b8c5 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1115,17 +1115,6 @@ int Http2Session::OnStreamClose(nghttp2_session* handle, if (!stream || stream->is_destroyed()) return 0; - // Don't close synchronously in case there's pending data to be written. This - // may happen when writing trailing headers. - if (code == NGHTTP2_NO_ERROR && nghttp2_session_want_write(handle) && - !env->is_stopping()) { - env->SetImmediate([handle, id, code, user_data](Environment* env) { - OnStreamClose(handle, id, code, user_data); - }); - - return 0; - } - stream->Close(code); // It is possible for the stream close to occur before the stream is diff --git a/test/parallel/test-http2-trailers-after-session-close.js b/test/known_issues/test-http2-trailers-after-session-close.js similarity index 81% rename from test/parallel/test-http2-trailers-after-session-close.js rename to test/known_issues/test-http2-trailers-after-session-close.js index d08f875494139c..3d5be11e5b5185 100644 --- a/test/parallel/test-http2-trailers-after-session-close.js +++ b/test/known_issues/test-http2-trailers-after-session-close.js @@ -1,8 +1,13 @@ 'use strict'; +// Fixes: https://github.com/nodejs/node/issues/42713 const common = require('../common'); -if (!common.hasCrypto) +if (!common.hasCrypto) { + // Remove require('assert').fail when issue is fixed and test + // is moved out of the known_issues directory. + require('assert').fail('missing crypto'); common.skip('missing crypto'); +} const assert = require('assert'); const http2 = require('http2'); @@ -31,7 +36,7 @@ server.listen(0, common.mustCall(() => { client.socket.on('close', common.mustCall()); const req = client.request({ [HTTP2_HEADER_PATH]: '/', - [HTTP2_HEADER_METHOD]: 'POST' + [HTTP2_HEADER_METHOD]: 'POST', }); req.end(); req.on('response', common.mustCall());