Closed
Description
Version: 15.1.0
thru 15.11.0
(see screenshot below)
Platform: Darwin CALLMT20389 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
What steps will reproduce the bug?
Run the following simple repro example:
$> node ./parent.mjs
parent.mjs
import { fork } from 'child_process';
const subprocess = fork('./child.mjs');
subprocess.on('close', (...args) => { console.error('[PARENT] received', ...args) });
subprocess.on('disconnect', (...args) => { console.error('[PARENT] received', ...args) });
subprocess.on('error', (...args) => { console.error('[PARENT] received', ...args) });
subprocess.on('exit', (...args) => { console.error('[PARENT] received', ...args) });
subprocess.on('message', (...args) => { console.log('[PARENT] received', ...args) });
subprocess.on('spawn', () => {
console.log({
'parent::subprocess.send': subprocess.send({ hello: 'child' })
});
});
child.mjs
process.on('message', (...args) => { console.log('[CHILD] received', ...args) });
process.send({ hello: 'parent' });
How often does it reproduce? Is there a required condition?
100% of the time (dozens of executions)
What is the expected behavior?
child's process.on('message') should be triggered (parent's message should be received and logged to console).
What do you see instead?
Only parent's subprocess.on('message') is triggered:
$> node ./parent.mjs
{ 'parent::subprocess.send': true }
[PARENT] received { hello: 'parent' }
Additional info
I installed node via nvm. I verified the version of node actually running is truly 15.11.0 by console logging process.version
in both parent.mjs and child.mjs (both output v15.11.0
)