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

net: wait for shutdown to complete before closing #32491

Closed
wants to merge 6 commits into from

Conversation

ronag
Copy link
Member

@ronag ronag commented Mar 25, 2020

When not allowing half open, handle.close would be
invoked before shutdown has been called and
completed causing a potential data race.

Fixes: #32486 (comment)

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

When not allowing half open, handle.close would be
invoked before shutdown has been called and
completed causing a potential data race.

Fixes: nodejs#32486 (comment)
@ronag ronag added wip Issues and PRs that are still a work in progress. net Issues and PRs related to the net subsystem. labels Mar 25, 2020
@ronag
Copy link
Member Author

ronag commented Mar 25, 2020

This is WIP I'm expecting it to fail in CI on win10 (#32487)

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 25, 2020

CI: https://ci.nodejs.org/job/node-test-pull-request/30072/ (:yellow_heart:)

@ronag ronag removed the wip Issues and PRs that are still a work in progress. label Mar 25, 2020
@@ -65,9 +65,7 @@ function onexit() {
{ type: 'TCPCONNECTWRAP',
id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
{ type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
{ type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' },
{ type: 'Immediate', id: 'immediate:1', triggerAsyncId: 'tcp:2' },
{ type: 'Immediate', id: 'immediate:2', triggerAsyncId: 'tcp:1' },
Copy link
Member Author

Choose a reason for hiding this comment

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

The order of Immediate here is platform dependent...

@ronag ronag requested a review from jasnell March 25, 2020 22:11
@ronag
Copy link
Member Author

ronag commented Mar 25, 2020

@addaleax PTAL, I've applied the required win10 fix. I think this should be able to land as a patch?

@ronag ronag requested a review from sam-github March 25, 2020 22:21
@ronag ronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 25, 2020
@addaleax addaleax added the review wanted PRs that need reviews. label Mar 28, 2020
@lpinca
Copy link
Member

lpinca commented Mar 29, 2020

I don't understand why the lib/internal/stream_base_commons.js change is needed (#32487). The other changes make sense.

@ronag
Copy link
Member Author

ronag commented Apr 1, 2020

Landed in 138eb32

@ronag ronag closed this Apr 1, 2020
ronag added a commit that referenced this pull request Apr 1, 2020
When not allowing half open, handle.close would be
invoked before shutdown has been called and
completed causing a potential data race.

Fixes: #32486 (comment)

PR-URL: #32491
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
BethGriggs pushed a commit that referenced this pull request Apr 7, 2020
When not allowing half open, handle.close would be
invoked before shutdown has been called and
completed causing a potential data race.

Fixes: #32486 (comment)

PR-URL: #32491
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit that referenced this pull request Apr 12, 2020
When not allowing half open, handle.close would be
invoked before shutdown has been called and
completed causing a potential data race.

Fixes: #32486 (comment)

PR-URL: #32491
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit that referenced this pull request Apr 22, 2020
When not allowing half open, handle.close would be
invoked before shutdown has been called and
completed causing a potential data race.

Fixes: #32486 (comment)

PR-URL: #32491
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. net Issues and PRs related to the net subsystem. review wanted PRs that need reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ShutdownWrap vs handle.close
4 participants