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: add support for AbortSignal to http2Session.request #36070

Closed

Conversation

MadaraUchiha
Copy link
Contributor

@MadaraUchiha MadaraUchiha commented Nov 10, 2020

  • Add support
  • Add test
  • Docs once PR is up
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

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added the http2 Issues or PRs related to the http2 subsystem. label Nov 10, 2020
@MadaraUchiha MadaraUchiha marked this pull request as ready for review November 10, 2020 17:19
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

Is it the same as #36048?

doc/api/http2.md Outdated Show resolved Hide resolved
@benjamingr
Copy link
Member

@aduh95 this is HTTP2 and the one I opened is HTTP :) I spoke with Dor and suggested this as a contribution opportunity

@benjamingr
Copy link
Member

Ping @jasnell on http2 + AbortController :]

@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 10, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 10, 2020
@nodejs-github-bot
Copy link
Collaborator

@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 10, 2020
const signal = options.signal;
if (signal) {
validateAbortSignal(signal, 'options.signal');
const listener = () => stream.destroy();
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer this to be called with an error.

Copy link
Contributor Author

@MadaraUchiha MadaraUchiha Nov 10, 2020

Choose a reason for hiding this comment

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

I've been following the discussion on #36048 on the same topic. I don't know enough about the specs and surrounding discussion to have an opinion either way, but over there it looks like it's not being called with an error either (at least for now).

Whatever the decision is it should probably be consistent in both http and http2 😄, whatever you guys decide I'm game.

cc @benjamingr

Copy link
Member

Choose a reason for hiding this comment

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

This already terminates with an error though and there is a test for that? Destroying the stream early (even without an explicit error on the http2 request) emits an error (right?)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but I think destroying with an explicit aborted DOMException like we do elsewhere is good for consistency here.

Copy link
Member

Choose a reason for hiding this comment

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

@jasnell but wouldn't the request get aborted with an ECONNRESET (like in the test) anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ECONNREFUSED if it's aborted on the same tick, ECONNRESET otherwise. (Also, think that should be enforced by the test?)

Copy link
Member

Choose a reason for hiding this comment

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

Test appreciated, I think the errors a refine no?

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 10, 2020
@nodejs-github-bot
Copy link
Collaborator

lib/internal/http2/core.js Outdated Show resolved Hide resolved
@benjamingr
Copy link
Member

See additional discussion here: #36048 (comment)

@aduh95
Copy link
Contributor

aduh95 commented Nov 17, 2020

This needs a rebase.

- Remove redundant socket check
- Add assertion that AbortSignal event listener gets added then removed.
- Builds on nodejs#36048 and nodejs#36084
- Modify test to verify this fact
- Calling abort no longer behaves like .destroy()
- Fix linting errors
@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 21, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 21, 2020
@nodejs-github-bot
Copy link
Collaborator

@benjamingr benjamingr added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 21, 2020
@github-actions github-actions bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Nov 21, 2020
@github-actions
Copy link
Contributor

Commit Queue failed
- Loading data for nodejs/node/pull/36070
✔  Done loading data for nodejs/node/pull/36070
----------------------------------- PR info ------------------------------------
Title      http2: add support for AbortSignal to http2Session.request (#36070)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     MadaraUchiha:add-abortsignal-http2-request -> nodejs:master
Labels     http2
Commits    9
 - http2: add support for AbortSignal to http2Session.request
 - http2: Document AbortSignalSupport
 - http2: Fix lint errors
 - http2: Remove redundant empty line in docs
 - http2: Use existing signal constant
 - http2: Goodify test
 - http2: Abort calls destroy with an AbortError
 - http2: Update documentation
 - http2: Abort immediately if passed an already aborted signal
Committers 1
 - Madara Uchiha 
PR-URL: https://github.com/nodejs/node/pull/36070
Reviewed-By: Matteo Collina 
Reviewed-By: Benjamin Gruenbaum 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/36070
Reviewed-By: Matteo Collina 
Reviewed-By: Benjamin Gruenbaum 
--------------------------------------------------------------------------------
   ✔  Last GitHub Actions successful
   ℹ  Last Full PR CI on 2020-11-21T10:44:25Z: https://ci.nodejs.org/job/node-test-pull-request/34501/
- Querying data for job/node-test-pull-request/34501/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
   ℹ  This PR was created on Tue, 10 Nov 2020 17:09:52 GMT
   ✔  Approvals: 2
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/36070#pullrequestreview-535274077
   ✔  - Benjamin Gruenbaum (@benjamingr): https://github.com/nodejs/node/pull/36070#pullrequestreview-535962363
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/master up to date...
From https://github.com/nodejs/node
 * branch                  master     -> FETCH_HEAD
✔  origin/master is now up-to-date
- Downloading patch for 36070
From https://github.com/nodejs/node
 * branch                  refs/pull/36070/merge -> FETCH_HEAD
✔  Fetched commits as 03fd3634721e..9aca7c4e0f76
--------------------------------------------------------------------------------
[master 9f4c660e32] http2: add support for AbortSignal to http2Session.request
 Author: Madara Uchiha 
 Date: Tue Nov 10 19:06:41 2020 +0200
 2 files changed, 40 insertions(+)
[master 5ee4ab7351] http2: Document AbortSignalSupport
 Author: Madara Uchiha 
 Date: Tue Nov 10 19:14:04 2020 +0200
 1 file changed, 10 insertions(+)
[master 2be6c72532] http2: Fix lint errors
 Author: Madara Uchiha 
 Date: Tue Nov 10 19:17:55 2020 +0200
 2 files changed, 2 insertions(+), 2 deletions(-)
[master 81dfc6af59] http2: Remove redundant empty line in docs
 Author: Madara Uchiha 
 Date: Tue Nov 10 20:09:40 2020 +0200
 1 file changed, 1 deletion(-)
[master db67139056] http2: Use existing signal constant
 Author: Madara Uchiha 
 Date: Tue Nov 10 21:41:02 2020 +0200
 1 file changed, 1 insertion(+), 1 deletion(-)
[master 244e6f6448] http2: Goodify test
 Author: Madara Uchiha 
 Date: Wed Nov 11 00:22:01 2020 +0200
 2 files changed, 11 insertions(+), 7 deletions(-)
[master 158e3daeee] http2: Abort calls destroy with an AbortError
 Author: Madara Uchiha 
 Date: Thu Nov 19 19:29:00 2020 +0200
 2 files changed, 16 insertions(+), 9 deletions(-)
[master 9c33a11777] http2: Update documentation
 Author: Madara Uchiha 
 Date: Thu Nov 19 19:43:31 2020 +0200
 2 files changed, 7 insertions(+), 7 deletions(-)
[master f980a8d85b] http2: Abort immediately if passed an already aborted signal
 Author: Madara Uchiha 
 Date: Thu Nov 19 21:00:33 2020 +0200
 2 files changed, 44 insertions(+), 5 deletions(-)
   ✔  Patches applied
There are 9 commits in the PR. Attempting autorebase.
Rebasing (2/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: add support for AbortSignal to http2Session.request

  • Add support
  • Add test
  • Docs once PR is up

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD d65c800a3e] http2: add support for AbortSignal to http2Session.request
Author: Madara Uchiha [email protected]
Date: Tue Nov 10 19:06:41 2020 +0200
2 files changed, 40 insertions(+)
Rebasing (3/18)
Rebasing (4/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Document AbortSignalSupport

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD 244467fb85] http2: Document AbortSignalSupport
Author: Madara Uchiha [email protected]
Date: Tue Nov 10 19:14:04 2020 +0200
1 file changed, 10 insertions(+)
Rebasing (5/18)
Rebasing (6/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Fix lint errors

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD f80ed3b090] http2: Fix lint errors
Author: Madara Uchiha [email protected]
Date: Tue Nov 10 19:17:55 2020 +0200
2 files changed, 2 insertions(+), 2 deletions(-)
Rebasing (7/18)
Rebasing (8/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Remove redundant empty line in docs

Co-authored-by: Antoine du Hamel [email protected]

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD d3a56e43a2] http2: Remove redundant empty line in docs
Author: Madara Uchiha [email protected]
Date: Tue Nov 10 20:09:40 2020 +0200
1 file changed, 1 deletion(-)
Rebasing (9/18)
Rebasing (10/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Use existing signal constant

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD ae57ff3b36] http2: Use existing signal constant
Author: Madara Uchiha [email protected]
Date: Tue Nov 10 21:41:02 2020 +0200
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (11/18)
Rebasing (12/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Goodify test

  • Remove redundant socket check
  • Add assertion that AbortSignal event listener gets added then removed.

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD a005decb4e] http2: Goodify test
Author: Madara Uchiha [email protected]
Date: Wed Nov 11 00:22:01 2020 +0200
2 files changed, 11 insertions(+), 7 deletions(-)
Rebasing (13/18)
Rebasing (14/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Abort calls destroy with an AbortError

  • Builds on #36048 and #36084
  • Modify test to verify this fact

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD 681a25a7c1] http2: Abort calls destroy with an AbortError
Author: Madara Uchiha [email protected]
Date: Thu Nov 19 19:29:00 2020 +0200
2 files changed, 16 insertions(+), 9 deletions(-)
Rebasing (15/18)
Rebasing (16/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Update documentation

  • Calling abort no longer behaves like .destroy()
  • Fix linting errors

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD f7cfaf47e2] http2: Update documentation
Author: Madara Uchiha [email protected]
Date: Thu Nov 19 19:43:31 2020 +0200
2 files changed, 7 insertions(+), 7 deletions(-)
Rebasing (17/18)
Rebasing (18/18)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
http2: Abort immediately if passed an already aborted signal

  • Also add test to that effect

PR-URL: #36070
Reviewed-By: Matteo Collina [email protected]
Reviewed-By: Benjamin Gruenbaum [email protected]

[detached HEAD 8fee716ecf] http2: Abort immediately if passed an already aborted signal
Author: Madara Uchiha [email protected]
Date: Thu Nov 19 21:00:33 2020 +0200
2 files changed, 44 insertions(+), 5 deletions(-)

Successfully rebased and updated refs/heads/master.
✔ d65c800a3ef342660e4f19eadd8cbce9ffb65e76
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 5:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
⚠ 0:50 Title should be <= 50 columns. title-length
✖ 244467fb85317f6bef001a4af863a014f2ff4034
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ f80ed3b090c09005aa1c74f562c2cc0e7234a540
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ d3a56e43a208266663c1dd1a5af434d5912e8fd6
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 5:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ ae57ff3b36e823eddd37196961f255a2625b0be3
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 3:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ a005decb4e0643ef0e55f8708dcb920d7b73b7f9
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 4:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ 681a25a7c13504f128d1dba03b29ba2321339b9b
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 4:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ f7cfaf47e246ecf02284ef8a587f7e04fb898058
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 4:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ 8fee716ecfc84d9d616e50f6ce3cae025d6651e5
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 3:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✖ 0:8 First word after subsystem(s) in title should be lowercase. title-format
⚠ 0:50 Title should be <= 50 columns. title-length
ℹ Please fix the commit message and try again.

https://github.com/nodejs/node/actions/runs/376031910

benjamingr pushed a commit that referenced this pull request Nov 21, 2020
- Add support
- Add test
- Docs once PR is up

PR-URL: #36070
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@benjamingr
Copy link
Member

Landed manually in 630afc3 🎉

@benjamingr benjamingr closed this Nov 21, 2020
codebytere pushed a commit that referenced this pull request Nov 22, 2020
- Add support
- Add test
- Docs once PR is up

PR-URL: #36070
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@codebytere codebytere mentioned this pull request Nov 22, 2020
@MadaraUchiha MadaraUchiha deleted the add-abortsignal-http2-request branch November 22, 2020 22:13
@targos targos added backport-open-v14.x and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Apr 24, 2021
targos pushed a commit to targos/node that referenced this pull request Apr 24, 2021
- Add support
- Add test
- Docs once PR is up

PR-URL: nodejs#36070
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 26, 2021
- Add support
- Add test
- Docs once PR is up

PR-URL: nodejs#36070
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 30, 2021
- Add support
- Add test
- Docs once PR is up

PR-URL: nodejs#36070
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this pull request Apr 30, 2021
- Add support
- Add test
- Docs once PR is up

PR-URL: #36070
Backport-PR-URL: #38386
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@danielleadams danielleadams mentioned this pull request May 3, 2021
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.

7 participants