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

src: fix StreamPipe cleanup & interaction with env handles #26256

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

src: do not access Environment-owned handles after cleanup

Do not access handles that have already begun to be closed
or are closed.

src: clean up StreamPipe in destructor

In the presence of Workers, it is not safe to assume that
StreamPipe::Unpipe() has been called at the time when the object
is destroyed.

Instead, clean up when the destructor is called.

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

Do not access handles that have already begun to be closed
or are closed.
In the presence of Workers, it is not safe to assume that
`StreamPipe::Unpipe()` has been called at the time when the object
is destroyed.

Instead, clean up when the destructor is called.
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Feb 21, 2019
env->CloseHandle(handle, [](uv_handle_t* handle) {});
env->CloseHandle(handle, [](uv_handle_t* handle) {
#ifdef DEBUG
memset(handle, 0xab, uv_handle_size(handle->type));
Copy link
Member

Choose a reason for hiding this comment

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

👍

@addaleax
Copy link
Member Author

@addaleax
Copy link
Member Author

addaleax commented Mar 1, 2019

Landed in cb9d0ec, 08abb3b

@addaleax addaleax closed this Mar 1, 2019
@addaleax addaleax deleted the worker-stream-pipe branch March 1, 2019 09:50
addaleax added a commit that referenced this pull request Mar 1, 2019
Do not access handles that have already begun to be closed
or are closed.

PR-URL: #26256
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
addaleax added a commit that referenced this pull request Mar 1, 2019
In the presence of Workers, it is not safe to assume that
`StreamPipe::Unpipe()` has been called at the time when the object
is destroyed.

Instead, clean up when the destructor is called.

PR-URL: #26256
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
addaleax added a commit that referenced this pull request Mar 1, 2019
Do not access handles that have already begun to be closed
or are closed.

PR-URL: #26256
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
addaleax added a commit that referenced this pull request Mar 1, 2019
In the presence of Workers, it is not safe to assume that
`StreamPipe::Unpipe()` has been called at the time when the object
is destroyed.

Instead, clean up when the destructor is called.

PR-URL: #26256
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@BridgeAR BridgeAR mentioned this pull request Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants