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

child_process: null channel handle on close #3041

Closed
wants to merge 2 commits into from

Conversation

indutny
Copy link
Member

@indutny indutny commented Sep 24, 2015

HandleWrap::OnClose destroys the underlying C++ object and null's the
internal field pointer to it. Therefore there should be no references to
the wrapping JavaScript object.

null the process' _channel field right after closing it, to ensure
no crashes will happen.

Fix: #2847

`HandleWrap::OnClose` destroys the underlying C++ object and null's the
internal field pointer to it. Therefore there should be no references to
the wrapping JavaScript object.

`null` the process' `_channel` field right after closing it, to ensure
no crashes will happen.

Fix: nodejs#2847
@indutny
Copy link
Member Author

indutny commented Sep 24, 2015

cc @nodejs/collaborators

@indutny indutny added the child_process Issues and PRs related to the child_process subsystem. label Sep 24, 2015
'use strict';

const assert = require('assert');
const common = require('../common');
Copy link
Contributor

Choose a reason for hiding this comment

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

common should be loaded first. It has some global pollution detection logic.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok.

@indutny
Copy link
Member Author

indutny commented Sep 24, 2015

@thefourtheye fixed, thanks!

@trevnorris
Copy link
Contributor

LGTM

server.close();
}));

// Queue up several handles, to make `process.disconnect()` wait
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the surrounding code, without this loop also the assertion in close event will be satisfied, right?

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 worker won't exit without the loop. It expect the message to come. Sending multiple items is crucial to make this test fail on the unpatched node.

@indutny
Copy link
Member Author

indutny commented Sep 24, 2015

@thefourtheye may I ask you to finish the review ;)

@thefourtheye
Copy link
Contributor

LGTM

@indutny
Copy link
Member Author

indutny commented Sep 25, 2015

Thanks! Going to run CI and land it.

@indutny
Copy link
Member Author

indutny commented Sep 25, 2015

@indutny
Copy link
Member Author

indutny commented Sep 25, 2015

Landed in 36b969f, thank you!

indutny added a commit that referenced this pull request Sep 25, 2015
`HandleWrap::OnClose` destroys the underlying C++ object and null's the
internal field pointer to it. Therefore there should be no references to
the wrapping JavaScript object.

`null` the process' `_channel` field right after closing it, to ensure
no crashes will happen.

Fix: #2847
PR-URL: #3041
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
@indutny indutny closed this Sep 25, 2015
@indutny indutny deleted the fix/gh-2847 branch September 25, 2015 04:18
indutny added a commit that referenced this pull request Sep 25, 2015
`HandleWrap::OnClose` destroys the underlying C++ object and null's the
internal field pointer to it. Therefore there should be no references to
the wrapping JavaScript object.

`null` the process' `_channel` field right after closing it, to ensure
no crashes will happen.

Fix: #2847
PR-URL: #3041
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This was referenced Sep 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants