Skip to content

Conversation

@apapirovski
Copy link
Contributor

Adjust http2 behaviour to allow ending a stream even after some
data comes in (when the user has no intention of reading that
data). Also correctly end a stream when trailers are present.

Fixes: #20060

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

Adjust http2 behaviour to allow ending a stream even after some data comes in (when the user has no intention of reading that data). Also correctly end a stream when trailers are present.
@apapirovskiapapirovski added the http2 Issues or PRs related to the http2 subsystem. label May 9, 2018
@nodejs-github-botnodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label May 9, 2018
@apapirovski
Copy link
ContributorAuthor

Copy link
Member

@jasnelljasnell left a comment

Choose a reason for hiding this comment

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

LGTM, would like @mcollina to review also :-)

@jasnelljasnell requested a review from mcollinaMay 9, 2018 17:23
@apapirovski
Copy link
ContributorAuthor

@mcollina since @jasnell requested your review, could you have a look? Thanks!

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@trivikrtrivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 16, 2018
stream.read(0);
}
if(!stream[kState].didRead&&!stream._readableState.resumeScheduled)
stream.resume();
Copy link
Member

Choose a reason for hiding this comment

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

this is slightly different than read(0). Can you please explain why this is needed?
I would prefer if we didn't use _readableState here.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This is equivalent to what we do in http and is needed because in cases where the user doesn't intend to consume the data (indicated by never having read and not having a pending resume call), we still want to be able to properly destroy the stream.

Copy link
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 comment about this?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Will do later today.

state.didRead=true;
this[kStream].on('data',onStreamData);
}else{
process.nextTick(resumeStream,this[kStream]);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the nextTick is needed here, as resume() happens in a nextTick anyway.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

That part is carried over from before (didn't change) and used to definitely be necessary. We have a test for it even which breaks otherwise: parallel/test-http2-compat-serverrequest-pipe.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

You could probably have a look at the git blame for the line to find the corresponding PR.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

See #15503 — I don't fully recall where exactly we have an async call to pause but we do somewhere.

Copy link
Member

@mcollinamcollinaMay 16, 2018

Choose a reason for hiding this comment

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

It's probably something we would have to look into. It's a pretty old one: #15702.

@trivikrtrivikr removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 17, 2018
@apapirovskiapapirovski added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 17, 2018
@apapirovski
Copy link
ContributorAuthor

Updated with the requested comment. Will be landing this later today.

@apapirovski
Copy link
ContributorAuthor

Landed in 8d38288. Thanks everyone!

@apapirovskiapapirovski deleted the fix-http2-end-without-read branch May 17, 2018 14:00
apapirovski added a commit that referenced this pull request May 17, 2018
Adjust http2 behaviour to allow ending a stream even after some data comes in (when the user has no intention of reading that data). Also correctly end a stream when trailers are present. PR-URL: #20621Fixes: #20060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
@addaleax
Copy link
Member

@apapirovski I think there’s a pretty high chance this is the cause of CI failures like these, given that this occurred somewhat frequently only today and this PR touched the test: https://ci.nodejs.org/job/node-test-commit-linuxone/1405/nodes=rhel72-s390x/testReport/junit/(root)/test/parallel_test_http2_client_upload_reject/

@BridgeAR
Copy link
Member

@addaleax I do not think that this is the cause of these issues. We have these failures since a couple of days and this PR just landed very recently.

@BridgeAR
Copy link
Member

See #20750

@addaleax
Copy link
Member

@BridgeAR Locally, for that specific test (which is not mentioned in the issue), I get:

  • a 25/1000 failure rate on master
  • a 19/1000 failure rate for the commit in which this PR landed, and
  • a 0/1000 failure rate for its parent.

That makes me somewhat confident that this PR is in fact the cause of what we’ve been seeing today?

@BridgeARBridgeAR mentioned this pull request May 19, 2018
4 tasks
@BridgeAR
Copy link
Member

I just had another look into it and you are right! I opened a revert #20832

MylesBorins pushed a commit that referenced this pull request May 22, 2018
Adjust http2 behaviour to allow ending a stream even after some data comes in (when the user has no intention of reading that data). Also correctly end a stream when trailers are present. PR-URL: #20621Fixes: #20060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
@addaleaxaddaleax mentioned this pull request May 22, 2018
kjin pushed a commit to kjin/node that referenced this pull request Aug 23, 2018
Adjust http2 behaviour to allow ending a stream even after some data comes in (when the user has no intention of reading that data). Also correctly end a stream when trailers are present. PR-URL: nodejs#20621Fixes: nodejs#20060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
kjin pushed a commit to kjin/node that referenced this pull request Sep 19, 2018
Adjust http2 behaviour to allow ending a stream even after some data comes in (when the user has no intention of reading that data). Also correctly end a stream when trailers are present. PR-URL: nodejs#20621Fixes: nodejs#20060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
kjin pushed a commit to kjin/node that referenced this pull request Oct 16, 2018
Adjust http2 behaviour to allow ending a stream even after some data comes in (when the user has no intention of reading that data). Also correctly end a stream when trailers are present. PR-URL: nodejs#20621Fixes: nodejs#20060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
BethGriggs pushed a commit that referenced this pull request Oct 17, 2018
Adjust http2 behaviour to allow ending a stream even after some data comes in (when the user has no intention of reading that data). Also correctly end a stream when trailers are present. Backport-PR-URL: #22850 PR-URL: #20621Fixes: #20060 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
@BethGriggsBethGriggs mentioned this pull request Oct 30, 2018
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.lib / srcIssues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

difference between http2 Compatibility API and http

7 participants

@apapirovski@addaleax@BridgeAR@mcollina@jasnell@trivikr@nodejs-github-bot