child_process: emit IPC messages on next tick
Currently, if an IPC event handler throws an error, it can cause the message to not be consumed, leading to messages piling up. This commit causes IPC events to be emitted on the next tick, allowing the channel's processing logic to move forward as normal. Fixes: https://github.com/nodejs/node/issues/6561 PR-URL: https://github.com/nodejs/node/pull/6909 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
parent
dab09877b0
commit
d59917b2a3
@ -715,7 +715,9 @@ function handleMessage(target, message, handle) {
|
||||
message.cmd.slice(0, INTERNAL_PREFIX.length) === INTERNAL_PREFIX) {
|
||||
eventName = 'internalMessage';
|
||||
}
|
||||
target.emit(eventName, message, handle);
|
||||
process.nextTick(() => {
|
||||
target.emit(eventName, message, handle);
|
||||
});
|
||||
}
|
||||
|
||||
function nop() { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user