anthropics / anthropics/claude-code

Headless claude -p deadlocks in uninterruptible openat on macOS; interactive sessions unaffected

オープン
#89,272 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:cli area:core bug has repro platform:macos
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

**Date:** 2026-08-24

## Summary
Every headless invocation (`claude -p`) on this machine deadlocks partway into the session:
main thread blocked forever in `openat$NOCANCEL`, 0% CPU, no TCP connections, no child
processes. Interactive sessions on the same machine, same account, are unaffected.
8/8 reproductions: 5 via a no-mistakes pipeline daemon spawning `claude -p --output-format
stream-json --json-schema ... --dangerously-skip-permissions`, and 3 spawned directly from a
shell with stdout redirected to a file (with and without `--debug`, with and without
`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`).

## Signature
- `sample `: main thread parked in `openat$NOCANCEL` (1500+/1500+ samples), JIT (JS)
frames above; worker threads idle in `kevent64`/pool waits.
- No TCP sockets open (`lsof`); not a network hang.
- No child processes; not a tool-subprocess hang.
- `SIGKILL` sometimes fails to reap the process (uninterruptible syscall).
- Freeze point varies by run: after ~2 tool rounds (transcript event 19, last =
`total_tokens_reminder` attachment), at `ai-title` (event 9), or at `atis-latch` (event 20).
Always coincides with concurrent background activity (session-title request in flight,
statsig/bootstrap fetch, atomic `~/.claude.json` rewrite).
- With `--debug`: log stops mid-stream right after two concurrent `/v1/messages` requests
(`source=generate_session_title` + `source=sdk`) both received first bytes.

## Ruled out
- no-mistakes daemon (reproduces with plain `claude -p` from a shell)
- claude version regression (2.1.235 and 2.1.241 both freeze)
- permission-prompt deadlock (`--dangerously-skip-permissions` present in pipeline repros)
- stdout backpressure (reproduces with stdout redirected to a regular file)
- hung file provider (Google Drive + fileproviderd restarted; CloudStorage lists fine)
- FIFOs / dead symlinks in cwd, skills, agents, plugins trees (none exist)
- keychain-db file locks (no holders)
- nonessential traffic (`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` still freezes)

## Not yet done (needs sudo)
`fs_usage`/`spindump` or lldb attach to capture the blocked path argument — lldb attach is
denied by SIP for a same-user attach on this machine.

## Repro
```
cd
echo 'Read README.md, then read pyproject.toml, then reply with one sentence.' | claude -p
# hangs forever; sample the pid to see openat$NOCANCEL
```

## Impact
Any local tooling that drives `claude -p` (review pipelines, cron jobs, CI-style local gates)
wedges silently. Workaround in use: pipeline agent switched to codex; Claude review still
applied via GitHub Actions (claude-review.yml) and interactive sessions.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start with the `claude -p` reproduction command from any Git repository and capture `--debug` output alongside `fs_usage`, `spindump`, or an lldb attach as described. Compare the headless path with the interactive session and the `claude-review.yml` workflow; done means the reported macOS invocation no longer deadlocks in `openat$NOCANCEL`.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, macos
領域
cli, operating-systems
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。