anthropics / anthropics/claude-code
[BUG] Linux/npm: auto-update leaves running sessions alive with zero sockets — Remote Control silently dead (no relaunch)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet (related, but different platform and mechanism: #94049, #95491, both Windows/macOS desktop app)
- This is a single bug report
- I am using the latest version of Claude Code
What's Wrong?
On Linux, CLI installed via npm-global, the background auto-updater replaces the install directory while long-lived terminal sessions are running. Those sessions stay alive, but afterward they hold zero network sockets. They never reconnect, and Remote Control from the phone app can no longer reach them. Nothing reports an error, so from the terminal the session looks healthy.
This differs from #94049 / #95491. There, the desktop app relaunches sessions and they come back without Remote Control. Here nothing relaunches. The original processes keep running from a deleted binary with no network connections, so the failure can't be seen in ps, the TTY, or the transcript.
Two long-lived sessions make it more likely. Each process runs its own updater, so the same install happened twice (10:55 and again at 11:55:41). The second run did the atomic directory swap under the sessions that were still running.
Observed on the live occurrence (2026-09-19, times EDT):
| time | observation |
|---|---|
| 09-18 08:55 | two claude sessions started in separate terminals (pts/0, pts/1), running 2.1.276, Remote Control attached from the mobile app |
| 09-19 10:55 | auto-update 2.1.276 → 2.1.278 (recorded in ~/.claude/.last-update-result.json) |
| ~11:18 | PID 3377642: 3 ESTABLISHED sockets (Anthropic API + relay), keepalive armed |
| 09-19 11:55:41 | .last-update-result.json rewritten, again 2.1.276 → 2.1.278. The install dir @anthropic-ai/claude-code has mtime 11:55:39–41 |
| by 12:11 | both original PIDs alive (27h uptime), 0 TCP sockets. Mobile app cannot reach them; I had to SSH in and start a new session |
What Should Happen?
Any of these would be fine:
- The running session reconnects using the code already loaded in memory, or
- It notices its install was replaced and tells me ("Claude Code was updated; restart to restore Remote Control"), or
- It exits cleanly, so the mobile app shows it as ended.
Also, the updater could defer while a session has Remote Control active. #95491 suggests the same thing for desktop.
Error Messages/Logs
No error is printed to the terminal. Process state after the failure:
$ readlink /proc/3377642/exe
~/.npm-global/lib/node_modules/@anthropic-ai/.claude-code-h9B5EqFE/bin/claude.exe (deleted)
$ grep -c '(deleted)' /proc/3377642/maps
5
$ ss -tnp | grep -c 'pid=3377642,'
0 # was 3 at ~11:18
# freshly started session, for comparison:
$ readlink /proc/1296141/exe
~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe
$ ss -tnp | grep -c 'pid=1296141,'
21
.claude-code-h9B5EqFE is the staging name npm gives the old directory during the atomic replace, before deleting it.
Ruled out on the host: OOM (no kills; ~39 GiB available), firewall (ufw inactive), NAT/idle timeout (keepalive timers armed at sub-second to ~40s intervals on the relay sockets), systemd-logind idle actions (defaults), shell TMOUT (unset). The client phone was switching between WiFi and cellular around the same time, but that can't close the server's own outbound sockets. The server also lost plain API sockets unrelated to Remote Control.
Caveat: I did not capture the exact moment the sockets closed. The correlation with the 11:55:41 install is tight but not proven. The deleted exe and the rewritten update record are both certain.
Steps to Reproduce
- Linux, install via npm-global on an older version (e.g.
npm i -g @anthropic-ai/claude-code@2.1.276). - Start two
claudesessions in separate terminals and attach Remote Control to them from the mobile app. - Leave them running until the auto-updater installs a newer version (or trigger an update from one of them).
- Check the older session:
readlink /proc/<pid>/exeshows(deleted), andss -tnp | grep pid=<pid>shows no sockets. Remote Control to it is dead, and the terminal shows no error.
Claude Model
Opus (not model-related)
Is this a regression?
Probably. Long-lived Remote Control sessions on this machine were stable for months and only started dropping recently. I don't know the exact last-good version.
Last Working Version
Unknown
Claude Code Version
2.1.276 (affected sessions) → 2.1.278 (installed by auto-update)
Platform
Anthropic API
Operating System
Ubuntu 24.04.4 LTS, kernel 7.0.0-31-generic x86_64
Terminal/Shell
bash; sessions started from a local terminal, accessed remotely via the Claude mobile app (Remote Control)
Additional Information
Workaround: set DISABLE_AUTOUPDATER=1 (in ~/.claude/settings.json → env) and run claude update manually between sessions.
Related: #94049 (Windows desktop, update relaunch drops all RC bridges), #95491 (desktop, RC not restored after stealth update), #33041 (RC disconnects frequently).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Linux npm-global auto-updater and the session/Remote Control lifecycle, then reproduce the issue with two long-lived sessions as described. Compare readlink /proc/<pid>/exe, socket counts, and ~/.claude/.last-update-result.json before and after the update. Done means an updated session reconnects, reports that it needs restarting, or exits cleanly instead of remaining silently alive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, typescript
- Domain
- cli, networking, release
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100