[BUG] claude --version hangs indefinitely on Hyper-V guest (hyperv_clocksource_tsc_page) — regression in 2.1.218, works on 2.1.0

Status Open
Reported on v2.1.218
Maintainer reply None cached
Activity 1 comment · opened Jul 23, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

claude --version hangs indefinitely on Hyper-V guest (hyperv_clocksource_tsc_page) — regression in 2.1.218, works on 2.1.0

What's Wrong?

claude --version hangs indefinitely (no output, no exit) on a Linux VM running under Microsoft Hyper-V. Confirmed via strace that the process never reaches application code — it livelocks inside V8 startup, in threads named HeapHelper, which spin forever via repeated sched_yield() calls without making progress. The process only exits on manual SIGINT.

Downgrading to @anthropic-ai/claude-code@2.1.0 resolves the issue immediately on the same host with no other changes. 2.1.218 reproduces it reliably.

Environment

  • @anthropic-ai/claude-code: 2.1.218 (broken) / 2.1.0 (working)
  • Node: v24.14.1
  • systemd-detect-virt: microsoft
  • uname -r: (fill in)
  • nproc: 16
  • Clocksource: hyperv_clocksource_tsc_page (/sys/devices/system/clocksource/clocksource0/current_clocksource)
  • Install method: sudo npm install -g @anthropic-ai/claude-code
  • Binary: /usr/local/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe (compiled single-executable, no separate cli.js/index.js to bypass it)

Steps to Reproduce

  1. Provision a Linux guest on a Hyper-V host (clocksource hyperv_clocksource_tsc_page, 16 vCPUs).
  2. sudo npm install -g @anthropic-ai/claude-code (installs 2.1.218)
  3. Run claude --version
  4. Process hangs indefinitely; no output, no error, no exit.

What I've Ruled Out

  • Not network/DNS — no connect()/socket() syscalls appear anywhere in the trace before the hang.
  • Not config corruption — removed ~/.claude.json entirely; no difference. Strace shows the app never even attempts to open a config file.
  • Not a stale/corrupt install — fully removed and reinstalled from scratch.
  • Not CPU affinity/scheduling alonetaskset -c 0,1 claude --version still hangs.
  • Not V8's background compilation poolNODE_OPTIONS="--v8-pool-size=0" claude --version still hangs.
  • Is the specific package versionnpm install -g @anthropic-ai/claude-code@2.1.0 on the identical host, identical Node version, resolves it completely.

Strace Findings

Full trace attached (trace_info.txt). Key points:

  • Process performs normal startup: signal handlers, cgroup detection (/sys/fs/cgroup/...), epoll_create1, timezone/localtime reads — all complete normally.
  • It then spawns several threads named HeapHelper via clone3.
  • These threads enter a tight loop of sched_yield() calls against each other indefinitely:

``
2011347 sched_yield(...)
2011348 sched_yield(...)
2011349 sched_yield(...)
2011350 sched_yield(...)
``

This continues without resolving until the main process receives SIGINT, at which point all threads exit cleanly (exit(0)), suggesting the shutdown path itself works fine — it's specifically the startup synchronization between these heap-helper threads that never converges.

  • No connect(), socket(), or application config file reads (e.g. ~/.claude.json) occur anywhere in the trace — the hang happens entirely within V8/Node runtime initialization, before Claude Code's own logic runs.

Suspected Root Cause

This pattern (multiple threads spin-waiting via sched_yield on a shared synchronization point) is consistent with a livelock in V8's sandbox/heap initialization under paravirtualized scheduling, specifically where the guest's clocksource is hyperv_clocksource_tsc_page rather than an invariant/constant TSC. It's possible a recent V8 or Node build bump between 2.1.0 and 2.1.218 changed the heap-helper thread startup/synchronization logic in a way that's sensitive to clock read latency or vCPU scheduling fairness under Hyper-V, causing what likely used to be a fast conditional wait to become a livelock in this environment.

Workaround

Pin to a known-good version:

sudo npm install -g @anthropic-ai/claude-code@2.1.0 --save-exact

Attachments

  • trace_info.txt — full strace -f output of the hang from execve through manual SIGINT

What Should Happen?

claude --version should return the version - or start the termnal when no option is used.

Error Messages/Logs

Steps to Reproduce

Provision a Linux guest on a Hyper-V host (clocksource hyperv_clocksource_tsc_page, 16 vCPUs).
sudo npm install -g @anthropic-ai/claude-code (installs 2.1.218)
Run claude --version
Process hangs indefinitely; no output, no error, no exit.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.0

Claude Code Version

2.1.218

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

trace_info.txt

While there are 3 other potential duplicates, this might give more details - the report is written by claude AI, which encouraged me to report it here.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗