Repository navigation
Description
Description
Bug Report
Description
opencode consumes 3.5–6GB of RSS memory on Linux within seconds of startup (opencode TUI or opencode web), rendering the system unusable due to memory pressure and swapping. The process spawns 40+ threads at startup, with one thread pinned at 100% CPU.
This affects both v1.14.25 and v1.15.11 (latest). The user reports it previously worked on this machine.
Environment
- OS: Ubuntu 24.04 LTS (Noble)
- Kernel: 6.17.0-29-generic (recently upgraded from 6.14.x on 2026-05-20)
- Architecture: x86_64 (AVX2 supported, glibc, not musl)
- Installation:
npm install -g opencode-ai(Node.js SEA binary) - System Node.js: v20.20.2 (irrelevant for SEA binary)
- RAM: 15.4 GB total
- Terminal: xterm-256color
To Reproduce
npm install -g opencode-ai
opencode web
# or
opencodeObserved Behavior
htop data after ~30 seconds of opencode web:
- RSS: 3,509 MB
- VIRT: 75.7 GB
- 40+ threads all sharing the same VIRT/RSS
- One thread at 100% CPU, others at 5-8% each
- Swap usage climbs from 0 to 4.5 GB
Memory maps analysis (at 5 seconds):
RSS: 1,210,224 KB (~1.18 GB)
PSS: 1,206,819 KB
Heap: ~856 MB
VIRT: 76,244,568 KB (~72.7 GB)
Threads: 44
Heap grows progressively until system runs out of memory.
Tested Mitigations (none help)
| Test | Result |
|---|---|
--pure flag (no plugins) |
RSS still 1.76 GB at 5s |
| Empty working directory | No difference |
unset MINIMAX_API_KEY CUSTOM_MODEL CUSTOM_LLM_URL |
No difference |
opencode serve (headless) |
Still high memory |
| v1.14.25 downgrade | Same behavior (3.5 GB RSS) |
| Running from tmp directory | No difference |
Binary Architecture
The npm package ships a Node.js Single Executable Application (SEA) — an ELF binary at bin/opencode.exe (or bin/opencode in v1.14.x). Verified correct Linux binary:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0
The postinstall.mjs script correctly resolves the opencode-linux-x64 native package on this system (not a cross-platform binary mismatch).
Suspected Cause
The V8 heap inside the SEA binary allocates ~856 MB baseline within 5 seconds and grows continuously. 44 threads at startup is unusually high for a CLI tool. The combination suggests either:
- A memory leak in the V8 heap management when running on newer Linux kernels (6.17.x)
- Excessive thread pool allocation during provider/model enumeration at startup
- A kernel-specific regression (user reports it worked before a kernel upgrade from 6.14.x to 6.17.x)
Cannot test older kernel at this time since the linux-image-6.14 packages have been auto-removed.
Plugins
pure也无效
OpenCode version
1.14.25 1.15.x
Steps to reproduce
No response
Screenshot and/or share link
2026-05-28T045337.log
The log contains repeated setRawMode failed with errno: 5 errors:
ERROR service=server-proxy e=setRawMode failed with errno: 5 exception
ERROR service=server-proxy error=setRawMode failed with errno: 5 process error
However, the terminal (xterm-256color on /dev/pts) is confirmed working fine — other TUI applications (htop, Claude Code, etc.) operate without issues. It may be a consequence of the thread/memory exhaustion rather than a root cause.
Operating System
ubuntu24.04
Terminal
gnome zshshell
Activity
github-actions commentedon May 28, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is related to the memory/VIRT growth described in those issues, please add your details (and ideally a heap snapshot) to #20695 rather than opening a separate report. If you believe your issue is distinct (e.g., the 100% CPU thread or the kernel 6.17 regression), please clarify that in your issue.
github-actions commentedon Jul 28, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.