Node: TypeError: Forked processes must have an IPC channel

Created on 18 Aug 2016  路  5Comments  路  Source: nodejs/node

v.6.4.0
Darwin MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64

I think this is my error, but maybe something to document?

After upgrading from 6.3 -> 6.4 fork will not accept the following:

fork('...', [], {
    stdio: [0,1,2] 
});

Requiring:

fork('...', [], {
    stdio: [0,1,2,'ipc']
});

_Not_ setting stdio also works...

child_process doc

Most helpful comment

why the ipc fd is only required in fork? not in spawn?
what's the fundamental difference between fork and spawn? isn't fork a specific type of spawn where process name is slated to node?

All 5 comments

fork() didn't support a stdio option before. Now it does.

Thanks. Would it be useful to update these docs to emphasize that? (right now the docs seem to imply that [0,1,2] is a valid setting, and that ipc is optional. Or maybe that's just me :)

https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio

We don't currently have a good way to mark when things like that change the way that we do when a new method is added. However, I agree that it would be good to update the stdio section of https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_child_process_fork_modulepath_args_options to say that an 'ipc' entry is required. Note, the docs you linked to probably aren't the ideal place to say that, since this is fork() specific.

You might want to use https://nodejs.org/api/cluster.html#cluster_cluster_settings as a reference if you plan to make a PR.

why the ipc fd is only required in fork? not in spawn?
what's the fundamental difference between fork and spawn? isn't fork a specific type of spawn where process name is slated to node?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikeal picture mikeal  路  197Comments

Trott picture Trott  路  87Comments

mikeal picture mikeal  路  90Comments

substack picture substack  路  878Comments

silverwind picture silverwind  路  113Comments