AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack Dev Server Livelocks On Darwin-Arm64 In Pnpm Workspaces, 603% CPU And Never Serves Requests

On macOS Apple Silicon in pnpm workspace monorepos, `next dev --turbo` enters a livelock where tokio-runtime-worker threads spin 100% inside next-swc.darwin-arm64.node contending on the turbo-tasks scheduler queue lock. CPU usage reaches 603–777%, RSS grows to 3.5GB, and the server accepts TCP connections but never compiles or responds. The bug affects every stable version from 16.2.6 to 16.3.2 and is fixed only in canary 16.4.0-canary.6 via PR #96808.

highConfidence 85%Next.jsAffected V16.2.6Affected V16.2.11Affected V16.3.0Affected V16.3.2Fixed V16.4.0-Canary.6

Origin Analysis

A turbo-tasks scheduler deadlock/livelock: when a scheduled task is read, the scheduler enqueues it and then re-acquires the queue lock in a loop, causing contention among 11 tokio workers; the fix executes scheduled tasks inline on read and waits on a completion event for in-progress tasks instead of re-acquiring the queue lock.
1. On macOS Apple Silicon, clone https://github.com/koding88/repro-turbo-livelock. 2. Run `pnpm install` and then `pnpm exec turbo run dev` (runs `next dev --turbo -p 3137`). 3. Observe `next-server` prints `✓ Ready in ~250ms` then CPU climbs to 603-777% and RSS grows from 858MB to 3.5GB within 2 minutes. 4. Run `curl http://localhost:3137/`; it hangs until client timeout (HTTP 000). No `Compiling /` line or error appears.

Fixing Code Block

Edge Case Audit

Using a canary release in production or long-term development is risky because canary builds may contain other unstable changes. If the canary introduces regressions, rollback by pinning the previous stable version (`pnpm add next@16.3.2 -W`) or switch to webpack. Monitor the Next.js release notes for a stable version that includes PR #96808.

Ecosystem Topology