Skip to content

Commit 0b8124f

Browse files
cjihrigMyles Borins
authored and
Myles Borins
committed
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: #6561 PR-URL: #6909 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
1 parent 1164f54 commit 0b8124f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/child_process.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,9 @@ function handleMessage(target, message, handle) {
692692
message.cmd.slice(0, INTERNAL_PREFIX.length) === INTERNAL_PREFIX) {
693693
eventName = 'internalMessage';
694694
}
695-
target.emit(eventName, message, handle);
695+
process.nextTick(() => {
696+
target.emit(eventName, message, handle);
697+
});
696698
}
697699

698700
function nop() { }

0 commit comments

Comments
 (0)