Skip to content
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

[Bug]: processChild fails to initialize under certain conditions when a custom ESM loader is present #12060

Closed
kherock opened this issue Nov 11, 2021 · 5 comments

Comments

@kherock
Copy link
Contributor

kherock commented Nov 11, 2021

Version

27.3.1

Steps to reproduce

  1. Clone https://github.com/kherock/jest-worker-spawn-bug
    • please look through the README for additional context!
    • this repo is using Yarn 3, however I can confirm that this issue isn't Yarn-specific.
  2. Run the example worker script with the custom ESM loader:
yarn install
yarn worker-with-loader

Expected behavior

The worker should initialize and run the procedure.

Actual behavior

The worker misses the initialization message and hangs until something requests for it to be killed.

Additional context

This appears to be a timing-sensitive issue. I'll try to test this on some other platforms when I have time. Also, since this uses --experimental-loader, I suspect this might be a Node.js bug/quirk. However, the current use of ChildProcess.send feels unsound.

I've also written up some more context in the reproduction repo readme:

https://github.com/kherock/jest-worker-spawn-bug/blob/main/README.md

Environment

System:
    OS: macOS 11.5.2
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 14.18.1 - ~/.volta/tools/image/node/14.18.1/bin/node
    Yarn: 3.2.0-rc.3.git.20211110.hash-83311e1d4 - ~/.volta/tools/image/yarn/1.22.11/bin/yarn
    npm: 6.14.15 - ~/.volta/tools/image/node/14.18.1/bin/npm
@merceyz
Copy link
Contributor

merceyz commented Nov 29, 2021

This seems to be a known issue in Node.js nodejs/node#39140 / nodejs/node#37782 with a solution in nodejs/node#37782 (comment)

@merceyz
Copy link
Contributor

merceyz commented Dec 18, 2021

Looks like nodejs/node#41221 will fix the issue in Node.js itself

@merceyz
Copy link
Contributor

merceyz commented Feb 8, 2022

nodejs/node#41221 has shipped in Node.js v16.14 and v17.4

@kherock
Copy link
Contributor Author

kherock commented Mar 18, 2022

I'm closing this since I've confirmed that everything behaves properly with Node v16.14.

@kherock kherock closed this as completed Mar 18, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants