-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Conversation
`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
cc @nodejs/collaborators |
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const common = require('../common'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
@thefourtheye fixed, thanks! |
LGTM |
server.close(); | ||
})); | ||
|
||
// Queue up several handles, to make `process.disconnect()` wait |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@thefourtheye may I ask you to finish the review ;) |
LGTM |
Thanks! Going to run CI and land it. |
Landed in 36b969f, thank you! |
`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>
`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>
HandleWrap::OnClose
destroys the underlying C++ object and null's theinternal 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 ensureno crashes will happen.
Fix: #2847