Channel plugin subprocesses (bun server.ts) leak across sessions — not killed on session exit
Summary
Channel plugin subprocesses are not being killed when a Claude Code session ends. Each new session spawns a new bun server.ts subprocess for each channel plugin, but old ones are never cleaned up. Over time this causes severe CPU and memory pressure.
What happened
After running multiple Claude Code sessions with the Telegram and Discord channel plugins enabled, I found 12 bun server.ts processes still running — 10 of them pegged at ~99–100% CPU each (~1000% total CPU). Some had been running since Tuesday (1500+ minutes of accumulated CPU time). Fans were running at full speed.
neat 44860 99.7 0.5 Tue09PM 1514:12 /Users/neat/.bun/bin/bun server.ts
neat 44741 99.0 0.1 Tue09PM 1510:25 /Users/neat/.bun/bin/bun server.ts
neat 44684 99.0 0.1 Tue09PM 1510:53 /Users/neat/.bun/bin/bun server.ts
neat 83191 99.0 0.4 Tue10PM 1354:31 /Users/neat/.bun/bin/bun server.ts
... (8 more)
All were running from the plugin cache:
~/.claude/plugins/cache/claude-plugins-official/telegram/0.0.4~/.claude/plugins/cache/claude-plugins-official/discord/0.0.4
pkill -f "bun server.ts" (SIGTERM) was ignored — required kill -9 to terminate them.
Root cause
Per the channels reference docs, Claude Code spawns channel plugin servers as subprocesses over stdio:
Claude Code spawns it as a subprocess and communicates over stdio.
The subprocess is spawned fresh each session, but there's no apparent cleanup on session exit (normal exit, crash, or restart). Each new session adds another live subprocess. The stdio connection to the dead session is gone but the process keeps running — spinning at 100% CPU.
Expected behavior
Channel plugin subprocesses should be killed (SIGTERM, then SIGKILL after a grace period) when their parent Claude Code session exits, regardless of how the session ends (clean exit, crash, restart).
Steps to reproduce
- Enable the Telegram or Discord channel plugin
- Start multiple Claude Code sessions (or restart the same session several times)
- Run
ps aux | grep "bun server.ts"— one new process per session, old ones still alive - Leave running for a few hours — CPU spins at ~99% per zombie process
Environment
- macOS Darwin 25.4.0
- Claude Code v2.1.80+
- Plugin:
claude-plugins-official/telegram@0.0.4,claude-plugins-official/discord@0.0.4 - Runtime: Bun
Workaround
Until fixed, manually kill leaked processes:
ps aux | grep "bun server.ts" | grep -v grep | awk '{print $2}' | xargs kill -9This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗