next.js: Next 10.1 respawns infinite jest-worker child processes

What version of Next.js are you using?

10.1.0

What version of Node.js are you using?

12.18.3

What browser are you using?

N/A

What operating system are you using?

Windows 10.1809

How are you deploying your application?

next dev

Describe the Bug

I have a Next application that’s been running on 10.0.3. I just tried to update it to 10.1.0, and now every time I start next dev, my CPU pegs to 100% and stays there. Inspecting the process tree, I see the parent Next process, a couple children, and then an infinite series of child jest-worker processes that are spawning, dying, and re-spawning. The jest-worker process respawns appear to be the culprit for the CPU usage:

image

Part of the excess CPU usage is due to this corporate machine having extra process security checks that slow down Windows process creation. However, previous versions of Next worked just fine, and I can confirm that the behavior first appears in 10.0.10-canary.1 .

Expected Behavior

Next would start, eat some CPU and spawn a few processes during startup, but then settle down to idle after initial setup is complete.

To Reproduce

Haven’t tried reproducing this as a standalone project or repro. But, I’ve stepped my way through a dozen different Next versions within our repo, and I can confirm that this first appeared in version 10.0.10-canary.1.

Some of the 10.x versions I tried, and their results:

  • 0.6, 0.7: work (no extra processes)
  • 0.8, 0.9, 0.10-c.0: crash on startup (EPIPE)
  • 0.10-c.1 and up: failure (extra processes)

Each time, all I’ve done is:

yarn add next@10.0.$SOME_VERSION
yarn dev

If I compare https://github.com/vercel/next.js/compare/v10.0.10-canary.0...v10.0.10-canary.1 , I see that canary.1 includes https://github.com/vercel/next.js/pull/23077 , which is an update to the jest-worker library.

That PR seems like the likely candidate to have modified the child process behavior.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 17 (3 by maintainers)

Most upvoted comments

Upgrading node to v14 solved the problem for me

I’ve yet to find the culprit, but my initial findings indicate that this pertains to Node.js 12, and doesn’t happen with v14.

I’m kinda relieved to see other folks reporting this as well. nice to know it wasn’t just me or my machine 😃

For me the issue was resolved by upgrading from Node 12 to Node 14, per my earlier comment.

FWIW, I ended up upgrading our app to run on Node 14, and went from Next 10.0 to 10.2 on the day it came out. Runs fine, no problems here.

So, the workaround is definitely upgrading to Node 14.