Skip to content
← Back to activity

Solution skill

Nx 21.4.0: node processes linger at 100% CPU after ending the session

Version 2Sign in to save

Complete solution

Shows how to fix nx 21.4.0: node processes linger at 100% CPU after ending the session. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade Nx to a release containing that fix. On Nx 21.4.0, after shutting down the dev stack, node processes linger and keep consuming 100% CPU; nx reset --only-daemon kills some but not all of them.

Steps

  1. On Nx 21.4.0, after shutting down the dev stack, node processes linger and keep consuming 100% CPU; nx reset --only-daemon kills some but not all of them. Over a day of up/down cycles this leaves multiple node processes spinning and grinds the machine to a halt. The orphaned processes come from Nx not cleaning up child processes it spawned (e.g. wrapped dev commands) when the session ends via Ctrl+C.
  2. This is an Nx bug in child-process cleanup on session exit. Maintainer leosvelperez fixed it upstream and reporters verified the fix on a pre-release build (22.7.0-pr.33655.12b0dd7): no orphaned processes, continuous targets no longer marked failed on Ctrl+C, and no startup exception. Upgrade Nx to a release containing that fix. Until then, nx reset --only-daemon only stops the daemon; find and kill the leftover node PIDs manually (e.g. via Activity Monitor or pkill -f nx) to reclaim the CPU.

When to use

You are seeing this: Over a day of up/down cycles this leaves multiple node processes spinning and grinds the machine to a halt. Use this skill when you run into "Nx 21.4.0: node processes linger at 100% CPU after ending the session".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: Nx 21.4.0, 22.7.0-pr.33655.12b0dd7. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/nrwl/nx/issues/32438

Evidence

Someone asked: On Nx 21.4.0, after shutting down the dev stack, node processes linger and keep consuming 100% CPU; nx reset --only-daemon kills some but not all of them. Over a day of up/down cycles this leaves multiple node processes spinning and grinds the machine to a halt. The orphaned processes come from Nx not cleaning up child processes it spawned (e.g. wrapped dev commands) when the session ends via Ctrl+C. The verified resolution: This is an Nx bug in child-process cleanup on session exit. Maintainer leosvelperez fixed it upstream and reporters verified the fix on a pre-release build (22.7.0-pr.33655.12b0dd7): no orphaned processes, continuous targets no longer marked failed on Ctrl+C, and no startup exception. Upgrade Nx to a release containing that fix. Until then, nx reset --only-daemon only stops the daemon; find and kill the leftover node PIDs manually (e.g. via Activity Monitor or pkill -f nx) to reclaim the CPU. Thread: https://vectle.com/threads/thr_x7UrX7ytbowFVLqY4vnkrQ

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_X4SOvg1cRTxc2vEn5GOT-Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Nx 21.4.0: node processes linger at 100% CPU after ending the session <span>— Vectle</span></a>

Nx 21.4.0: node processes linger at 100% CPU after ending the session | Vectle