question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
merceyzcommented, Feb 8, 2022

https://github.com/nodejs/node/pull/41221 has shipped in Node.js v16.14 and v17.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

ExpressJs is return error `ERR_MODULE_NOT_FOUND` if I ...
If someone is still searching, I got this error using node ... In your case, create a folder called app with an index.js...
Read more >
Using ES modules in Node.js - LogRocket Blog
Learn about the state of ES modules in Node today, including concerns realted to transitioning from and interoperability with CommonJS.
Read more >
A Complete Guide to Winston Logging in Node.js - Better Stack
In this tutorial, we will explain how to install, set up, and use the Winston logger in a Node.js application. We'll go through...
Read more >
Dynamic Distant Objects LOD - DynDOLOD - Nexus Mods
DynDOLOD is a set of simple tools based on xEdit/xLODGen to automatically create a Skyrim mod based on the load order which adds...
Read more >
Documentation - ECMAScript Modules in Node.js - TypeScript
Interoperating between the two module systems brings large challenges, with many new features to juggle; however, support for ESM in Node.js is now ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found