Skip to content

http2: make compat finished match http/1 - #24347

Closed
ronag wants to merge 1 commit into
nodejs:masterfrom
nxtedition:http2-simplify-finished
Closed

http2: make compat finished match http/1#24347
ronag wants to merge 1 commit into
nodejs:masterfrom
nxtedition:http2-simplify-finished

Conversation

@ronag

@ronagronag commented Nov 13, 2018

Copy link
Copy Markdown
Member

Looking at the http1 semantic the current http2 compat implementation of finished seems rather complicated and fragile? Also it doesn't match the semantics of http1.

I have one http2 compat test failing which I don't quite undertand the purpose of. Am I missing something critical here?

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Refs: #24743

NOTE TO SELF: review cb behaviour when ending and destroyed. Is ´onStreamCloseResponse` required?

@nodejs-github-botnodejs-github-bot added dont-land-on-v6.x http2 Issues or PRs related to the http2 subsystem. labels Nov 13, 2018
@ronag
ronagforce-pushed the http2-simplify-finished branch 4 times, most recently from e651c5b to 58be934CompareNovember 14, 2018 12:18
@ronag

ronag commented Nov 14, 2018

Copy link
Copy Markdown
MemberAuthor

The interesting part here is that in http1 finished doesn't seem to care whether the socket is closed or not, it only cares about whether end has been called or not. While in http2-compat it doesn't really care that much about end, instead if mostly cares about whether the socket is closed or not.

I think this discrepancy is also missing a test somewhere? @mcollina

EDIT: See, fab97ee

@ronagronag changed the title Http2 simplify finishedhttp2: compat simplify finishedNov 14, 2018
Comment threadlib/internal/http2/compat.js Outdated
@ronag
ronagforce-pushed the http2-simplify-finished branch 4 times, most recently from ae5a5f0 to e164f4eCompareNovember 14, 2018 12:39
Comment threadlib/internal/http2/compat.js Outdated
@mcollina

Copy link
Copy Markdown
Member

@jasnell can you help here?

@mcollina

Copy link
Copy Markdown
Member

The interesting part here is that in http1 finished doesn't seem to care whether the socket is closed or not, it only cares about whether end has been called or not. While in http2-compat it doesn't really care that much about end, instead if mostly cares about whether the socket is closed or not.

I think this discrepancy is also missing a test somewhere? @mcollina

I think this is just a difference that we need to fix.

@ronag

Copy link
Copy Markdown
MemberAuthor

I'm actually a bit unsure what happens if you call end on a closed connection in http1?

@ronag
ronagforce-pushed the http2-simplify-finished branch 2 times, most recently from 7a57643 to d9312e2CompareNovember 14, 2018 19:33

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please add a unit test that shows what you are trying to achieve?

Comment threadlib/internal/http2/compat.js Outdated
@mcollina

Copy link
Copy Markdown
Member

I'm actually a bit unsure what happens if you call end on a closed connection in http1?

if the stream is finished, nothing happens on multiple end() in HTTP1

if(this.finished){
returnthis;
.

If you are still unsure, have you trying preparing an example?

@ronag

Copy link
Copy Markdown
MemberAuthor

@mcollina

if the stream is finished, nothing happens on multiple end() in HTTP1

This is if you have called end() previously. But what if you call end for the first time after the socket has aborted.

@mcollina

Copy link
Copy Markdown
Member

Can you create an example to check this?

@jasnell

Copy link
Copy Markdown
Member

Sorry @mcollina, I just spotted the notification on this. I'll queue this one up and take a look hopefully later today.

apapirovski
apapirovski previously requested changes Nov 29, 2018

@apapirovskiapapirovski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm sorry, but this is completely incorrect. There's a good reason that this makes a test fail.

@ronag

Copy link
Copy Markdown
MemberAuthor

@apapirovski care to expand on that?

The failing test looks wrong for me:

constserver=createServer(mustCall((request,response)=>{strictEqual(response.finished,true);response.writeHead(HTTP_STATUS_OK,{foo: 'bar'});response.end('data',mustCall());}));

It test that respone.finished is truebeforeend() is called which is not how http/1 behaves.

@ronag
ronagforce-pushed the http2-simplify-finished branch 3 times, most recently from a518fe2 to 252a03fCompareNovember 29, 2018 21:47
@ronag
ronagforce-pushed the http2-simplify-finished branch 2 times, most recently from 8d09864 to 833e567CompareJanuary 8, 2020 12:03
@apapirovski

Copy link
Copy Markdown
Contributor

review cb behaviour when ending and destroyed. Is ´onStreamCloseResponse` required?

Yup, it is. We need to trigger those events in the HEAD case, as well as cleanup the proxy socket and other junk since otherwise they're mutually referencing each other and could cause memory leaks.

@ronag

Copy link
Copy Markdown
MemberAuthor

@Trott: CI

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronag

Copy link
Copy Markdown
MemberAuthor

Would this be a bug fix or semver-major?

@ronag

Copy link
Copy Markdown
MemberAuthor

@Trott: CI failed due to merge conflict. Please try again.

@jasnelljasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM as a bug fix

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronag

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronag

Copy link
Copy Markdown
MemberAuthor

@nodejs/build I seem to be having problems with node-test-binary-arm-12+ in multiple PR's. Even those that just touch docs? #31805

@rvagg

Copy link
Copy Markdown
Member

Thanks @ronag, don't treat this as a blocker for your code, it's a Jenkins problem on our end.

@nodejs/build we're having a commit-ref propagation problem, in https://ci.nodejs.org/job/node-test-pull-request/29176/:

anyone got time to look at this one? @joaocgreis I bet you'd have the most insight and could see the problem quickest if you're available.

@ronag

Copy link
Copy Markdown
MemberAuthor

@nodejs-github-bot

nodejs-github-bot commented Feb 18, 2020

Copy link
Copy Markdown
Collaborator

@joaocgreis

Copy link
Copy Markdown
Member

Please do not use the "Resume build" when the PR changes. The "Resume build" only starts jobs that failed, so jobs that passed before will remain green, even if they would fail with the new changes. The "Resume build" feature is a source of problems, but it's the only way we have to reduce the impact of infra failures.

Please use "Rebuild" instead when there are any changes in the PR.

Both e6a54b6 and db24c25 were the head of #31805 at some point. Only the node-test-binary-arm-12+ job was started in https://ci.nodejs.org/job/node-test-pull-request/29176/. The other two were re-used from a previous PR because they passed, so the compile job never ran for the latest head.

@ronag

Copy link
Copy Markdown
MemberAuthor

Landed in 8ba7a2f

@codebyterecodebytere mentioned this pull request Feb 29, 2020
@codebyterecodebytere mentioned this pull request Mar 17, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.http2Issues or PRs related to the http2 subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

13 participants

@ronag@mcollina@jasnell@Trott@nodejs-github-bot@mhdawson@apapirovski@sam-github@Fishrock123@rvagg@joaocgreis@ryzokuken@BridgeAR