anthropics / anthropics/claude-code
Deterministic SIGSEGV on claude CLI startup (free/__newlocale/pthread_once)
- 主要语言
- Python
- 星标
- 145k
- 派生
- 23.1k
- PR 合并指标
- PR 指标待抓取
描述
# Claude Code CLI: deterministic SIGSEGV on process startup
## Summary
Every fresh invocation of the `claude` binary segfaults during startup, before
producing any output — including `claude --version`. Reproduced 100% of the
time (3/3 just now, plus ~20 crashes over a prior ~10-minute window). A
long-running interactive session that has already gotten past whatever
initializes on startup keeps working fine; it's new process launches that die.
## Environment
- OS: Arch Linux (rolling), kernel `7.1.8-arch1-3`
- Two affected installs, same crash signature on both:
- App-installed: `/home/losera/.local/share/claude/versions/2.1.243`
- npm/mise-installed: `/home/losera/.local/share/mise/installs/node/22.23.2/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe`
## Reproduction
```
$ claude --version
Segmentation fault (core dumped)
```
No arguments needed. Also reliably triggered by the CLI's own shell integration:
the injected `grep`/`find` shell functions shell out to `claude` (as
`ARGV0=ugrep`/`ARGV0=bfs`) to provide fast search — every such invocation
crashed too, until routed around via `command grep`/`command find`.
## Crash signature (from `coredumpctl`, identical across every occurrence)
```
Signal: 11 (SEGV) si_code: SEGV_MAPERR
Stack trace:
#0 free
#1 __newlocale (libc.so.6)
#2 n/a (claude.exe)
#3 n/a (libc.so.6)
#4 pthread_once (libc.so.6)
#5-8 n/a (claude.exe)
#9 n/a (libc.so.6)
#10 pthread_once (libc.so.6)
#11-15 n/a (claude.exe)
#16 __libc_start_main (libc.so.6)
#17 n/a (claude.exe)
```
Pattern: a `pthread_once`-guarded one-time initializer (`__newlocale`) calling
`free()`, crashing with `SEGV_MAPERR` (invalid address, not just a null
deref). Reads like a race or reentrancy bug in one-time locale
initialization — consistent with why a process that's already past init
(this interactive session) keeps running, while every new process launch
(`--version`, or the grep/find subprocess spawns) dies before doing anything
else.
## Timeline
- 19:57:55–20:02:22 EDT — 7 crashes of the top-level `claude` process
(version 2.1.243), one apparently mid-interactive-session in a tmux pane.
- 20:05:19–20:08:06 EDT — crashes shift to the mise-installed
`claude.exe`, including via the grep/find shell-integration subprocess path.
- 20:29:26 EDT (just now) — reconfirmed live: 3/3 fresh `claude --version`
invocations crash identically.
## Impact
- Kills interactive sessions outright when hit mid-session.
- Breaks the CLI's own `grep`/`find` shell integration on every call.
- `claude --version` cannot even report a version right now on this machine.
## Ruled out
- Locale env is standard, not something exotic: `LANG=en_US.UTF-8`, all
`LC_*` inherit from it, `LC_ALL` unset. Not an obvious misconfiguration on
this end, despite the crash being inside `__newlocale`.
## Not yet determined
- Root cause inside `claude.exe` (frames are `n/a` — no symbols available
locally; raw core files are retained under
`/var/lib/systemd/coredump/core.claude*` if useful).
- Whether it's specific to this machine's locale/glibc configuration, or
reproducible more broadly.
贡献指南
这个仓库没有索引到贡献指南
调研方向
Reproduce the crash with `claude --version` and inspect the retained `/var/lib/systemd/coredump/core.claude*` files, comparing both installed binaries and the reported `free`/`__newlocale`/`pthread_once` stack. Determine whether the failure depends on the Arch Linux locale or glibc configuration and identify the startup path responsible. Done means fresh CLI launches and the grep/find shell-integration subprocesses no longer segfault.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- linux
- 领域
- cli, operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100