-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization
Description
OpenCode OOM Killer Issue - Memory Leak Analysis
Issue Description
OpenCode process was killed by the Linux OOM (Out of Memory) killer after extended runtime, indicating a potential memory leak.
Environment
- OS: Linux (Rocky Linux 9.x)
- Kernel: 5.14.0-611.20.1.el9_7.x86_64
- Total Memory: 32GB (32597668 kB)
- Total Swap: 2.3GB (2371580 kB)
- OpenCode Version: Latest (installed via npm)
Incident Details
Timestamp: January 21, 2026 00:02:33 (system time)
Memory Usage at Time of Kill
- Process ID: 13526 (opencode)
- Virtual Memory: 112,428,424 kB (~109.6 GB)
- Anonymous RSS: 24,458,756 kB (~23.3 GB)
- File RSS: 1,280 kB
- Page Tables: 68,636 kB
- UID: 1000
System State at Time of Incident
- Free Swap: Only 168 kB remaining (out of 2.3GB)
- Total Swap Usage: 2.3GB - 168kB = ~2.3GB fully utilized
- Available Memory: System was under memory pressure
Kernel Logs Analysis
[20511.133921] node invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=0
[20511.134589] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=user.slice,mems_allowed=0,global_oom,task_memcg=/user.slice/user-0.slice/session-3.scope,task=opencode,pid=13526,uid=1000
[20511.134668] Out of memory: Killed process 13526 (opencode) total-vm:112428424kB, anon-rss:24458756kB, file-rss:1280kB, shmem-rss:0kB, UID:1000 pgtables:68636kB oom_score_adj:0
Root Cause Analysis
1. Memory Leak Indicators
- OpenCode allocated ~109GB virtual memory but only used ~23GB physical memory
- This suggests potential memory fragmentation or leak in V8 heap
- Long-running process gradually consumed memory until system exhaustion
2. Swap Exhaustion
- System swap was completely exhausted (only 168kB free)
- This indicates prolonged memory pressure leading to swap usage
- OOM killer triggered when both physical memory and swap were exhausted
3. Node.js Memory Management
- The process was a Node.js application (
node invoked oom-killer) - V8 garbage collection may have been unable to reclaim memory effectively
- Possible memory leaks in JavaScript code or native modules
generated by opencode ai
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization