Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: delay closing stream #20997

Closed
wants to merge 1 commit into from

Conversation

apapirovski
Copy link
Member

Delay automatically closing the stream with setImmediate in order to allow any pushStreams to be sent first. Also disable the readable side of the pushStream since there should never be any data incoming.

I'm not able to make a test since technically what we were doing was fine (and works with our own client) but the browsers seem a bit too strict.

Fixes: #20992

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.
@apapirovski apapirovski added the http2 Issues or PRs related to the http2 subsystem. label May 28, 2018
@apapirovski apapirovski requested a review from jasnell May 28, 2018 07:30
@nodejs-github-bot nodejs-github-bot added dont-land-on-v4.x http2 Issues or PRs related to the http2 subsystem. labels May 28, 2018
@apapirovski
Copy link
Member Author

@apapirovski
Copy link
Member Author

ping @nodejs/http2 would like to get this in the next release.

@@ -2178,7 +2181,7 @@ class ServerHttp2Stream extends Http2Stream {
let headRequest = false;
if (headers[HTTP2_HEADER_METHOD] === HTTP2_METHOD_HEAD)
headRequest = options.endStream = true;
options.readable = !options.endStream;
options.readable = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasnell I remember we discussed this, and you had a very good reason why this was there. Can you please weight in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this extensively and I couldn't see a good reason. We (or nghttp2) don't let through any data from the other side as is anyway, so making the readable side open doesn't seem to make much sense... Would definitely love to know if there's something I missed though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am recalling correctly, this was there because of an earlier iteration. I don't think this is necessary now.

@apapirovski
Copy link
Member Author

ping @jasnell — would appreciate your review, in particular whether we're safe to set readable to false and if not, why not. Thanks!

@apapirovski
Copy link
Member Author

Landed in 87cd389

@apapirovski apapirovski closed this Jun 1, 2018
@apapirovski apapirovski deleted the fix-http2-push branch June 1, 2018 08:56
apapirovski added a commit that referenced this pull request Jun 1, 2018
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.

PR-URL: #20997
Fixes: #20992
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit that referenced this pull request Jun 1, 2018
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.

PR-URL: #20997
Fixes: #20992
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Jun 6, 2018
kjin pushed a commit to kjin/node that referenced this pull request Aug 23, 2018
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.

PR-URL: nodejs#20997
Fixes: nodejs#20992
Reviewed-By: James M Snell <jasnell@gmail.com>
kjin pushed a commit to kjin/node that referenced this pull request Sep 25, 2018
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.

PR-URL: nodejs#20997
Fixes: nodejs#20992
Reviewed-By: James M Snell <jasnell@gmail.com>
kjin pushed a commit to kjin/node that referenced this pull request Oct 16, 2018
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.

PR-URL: nodejs#20997
Fixes: nodejs#20992
Reviewed-By: James M Snell <jasnell@gmail.com>
BethGriggs pushed a commit that referenced this pull request Oct 17, 2018
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.

Backport-PR-URL: #22850
PR-URL: #20997
Fixes: #20992
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

http2 pushPromise in 10.2.0+
4 participants