-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
the child process created by child_process.fork can't receive message correctly when using ES module #39140
Comments
I think that this is a duplicate of #37782 tl;dr, yes this is an issue with how loading is now async, and the message is emitted too early before having an option to register |
Hi @xiefenga, I wanted to look into this issue but wasn't able to reproduce it (I tried Node.js v18.20.4, v20.18.0, v22.10.0, and v23.1.0). |
maybe it has been fixed in new version |
but i can't judge whethor can close this issue or not |
i tried in v20.15.0, it worked as expected, i think this issue can be closed |
What steps will reproduce the bug?
when using ES module and child_process to fork child process, even
'spawn'
event has happend,child process failed receive message from parent process.Complete Testcase
package.json:
master.js
worker.js
console ouput:
if i delay 1s send message to child process, it works:
console output:
What is the expected behavior?
the expected behavior just like this:
when i rename worker.js to worker.cjs, got expected result.
Possible cause
I suspect this may have something to do with ESM asynchronous execution.
The text was updated successfully, but these errors were encountered: