-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
doc: buffers are not sent over IPC with a socket #6951
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
Conversation
doc/api/child_process.md
Outdated
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.
This sentence seems incomplete. I would just stop after "will not be sent to the child." and remove the rest.
|
One comment, but LGTM. |
|
updated + added a new finding while trying to work around the issue myself. |
doc/api/child_process.md
Outdated
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.
Have you seen the keepOpen option to send()?
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket.
|
No I had not, tnx! Updated the diff. |
|
LGTM, landing this… |
|
Landed in 5207526. Thank you! |
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket. PR-URL: #6951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket. PR-URL: nodejs#6951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket. PR-URL: #6951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
|
this is not landing cleanly, and I'm not 100% it applies to v4.x Please backport if neccessary |
It does apply to v4.x as well: $ node --version
v4.4.7$ cat m.js
const fork = require('child_process').fork
const net = require('net')
const cp = fork('./child.js')
net.createServer(c => {
setTimeout(() => {
cp.send({}, c)
}, 500) // send the connection after a delay
}).listen(1234, () => {
net.createConnection(1234, function() {
var i = 0
setInterval(() => {
this.write(`${i++} `)
}, 100) // start sending data before the connection is sent to the child
})
})$ cat child.js
process.on('message', (m, c) => {
console.log('child: got connection')
c.pipe(process.stdout)
})$ node m.js
child: got connection
4 5 6 7 8 ^C |
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket. PR-URL: #6951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket. PR-URL: #6951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket. PR-URL: #6951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
If a socket is sent to a child, any data that is buffered in the socket will not be sent to the child. The child will only receive data from the socket that is sent after the child has the socket. PR-URL: #6951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Checklist
Affected core subsystem(s)
doc/child_process
Description of change
If a socket is sent to a child, any data that is buffered in the
socket will not be sent to the child. The child will only receive
data from the socket that is sent after the child has the socket.