🐛 Critical Memory Leak - opencode.exe consumed 113.4 GB virtual memory #8377

Closed
opened 2026-02-16 18:09:49 -05:00 by yindo · 2 comments
Owner

Originally created by @JobyGitGud on GitHub (Feb 2, 2026).

Originally assigned to: @rekram1-node on GitHub.

Bug Description

opencode.exe (v1.1.21) experienced a severe memory leak that consumed 113.4 GB of virtual memory, causing system-wide memory exhaustion, program crashes, and system unresponsiveness.

System Impact

  • System memory fully exhausted
  • Programs forced to close/crash
  • System hitching/freezing
  • General unresponsiveness
  • No bluescreen occurred (Windows detected and managed the low memory condition)

Evidence

Windows Event Log - Resource Exhaustion Detector

Event ID: 2004
Source: Microsoft-Windows-Resource-Exhaustion-Detector
Time: 2/2/2026 6:36:46 PM

Windows successfully diagnosed a low virtual memory condition.
The following programs consumed the most virtual memory:

opencode.exe (PID 4572) consumed 121770086400 bytes (113.4 GB)
NVIDIA Broadcast.exe (10364) consumed 1498415104 bytes (1.4 GB)
Camera Hub.exe (16784) consumed 902610944 bytes (861 MB)

Environment

  • OS: Windows (WinGet installation)
  • opencode version: 1.1.21
  • Installation method: WinGet (SST.opencode_Microsoft.Winget.Source_8wekyb3d8bbwe)
  • System RAM: 9.8 GB available (at time of check)

Activity at Time of Incident

Based on opencode logs from the incident timeframe:

Active Components:

  • Multiple agent sessions running (explore, sisyphus-junior, oracle, librarian, metis, momus, multimodal-looker)
  • MCP (Model Context Protocol) clients active: memory, context7, grep_app, websearch
  • External SSH connections to remote VPS servers
  • LSP servers enabled: deno, typescript, vue, eslint, oxlint, biome, gopls, ruby-lsp, pyright, and 15+ others

Errors Observed in Logs:

ERROR service=mcp clientName=memory error=MCP error -32601: Method not found failed to get prompts
ERROR service=mcp clientName=context7 error=MCP error -32601: Method not found failed to get prompts
ERROR service=mcp clientName=grep_app error=MCP error -32601: Method not found failed to get prompts

Memory Configuration References Found:

  • max_memory_restart: '2G' (observed in logs)

Additional Context

  • Process was running for an extended period with multiple parallel agent operations
  • System recovered after the resource exhaustion event
  • Current opencode processes (post-restart) show normal memory usage (~800MB - 1.9GB)
  • Log file from incident: 2026-02-03T002133.log (31MB, created at 6:38 PM)

Steps to Reproduce

Unknown - occurred during normal usage with multiple agents and MCP tools active.

Expected Behavior

Memory usage should remain stable and not grow unbounded, especially with max_memory_restart configured.

Actual Behavior

Virtual memory consumption grew to 113.4 GB despite 2G memory restart configuration, causing system-wide memory exhaustion.

Severity

🔴 CRITICAL - System stability impact, potential data loss from forced program closures

Possible Related Issues

  • MCP error -32601 may indicate protocol issues contributing to memory leak
  • Multiple concurrent agent sessions may not be properly releasing memory
  • Memory restart limit (2G) not being enforced or ineffective

Reported by: Sisyphus (Kimi k 2.5) on behalf of user
Investigation Date: 2/2/2026
Incident Date: 2/2/2026 6:36 PM

Originally created by @JobyGitGud on GitHub (Feb 2, 2026). Originally assigned to: @rekram1-node on GitHub. ## Bug Description opencode.exe (v1.1.21) experienced a severe memory leak that consumed 113.4 GB of virtual memory, causing system-wide memory exhaustion, program crashes, and system unresponsiveness. ### System Impact - System memory fully exhausted - Programs forced to close/crash - System hitching/freezing - General unresponsiveness - No bluescreen occurred (Windows detected and managed the low memory condition) ### Evidence #### Windows Event Log - Resource Exhaustion Detector Event ID: 2004 Source: Microsoft-Windows-Resource-Exhaustion-Detector Time: 2/2/2026 6:36:46 PM ``` Windows successfully diagnosed a low virtual memory condition. The following programs consumed the most virtual memory: opencode.exe (PID 4572) consumed 121770086400 bytes (113.4 GB) NVIDIA Broadcast.exe (10364) consumed 1498415104 bytes (1.4 GB) Camera Hub.exe (16784) consumed 902610944 bytes (861 MB) ``` ### Environment - OS: Windows (WinGet installation) - opencode version: 1.1.21 - Installation method: WinGet (SST.opencode_Microsoft.Winget.Source_8wekyb3d8bbwe) - System RAM: 9.8 GB available (at time of check) ### Activity at Time of Incident Based on opencode logs from the incident timeframe: Active Components: - Multiple agent sessions running (explore, sisyphus-junior, oracle, librarian, metis, momus, multimodal-looker) - MCP (Model Context Protocol) clients active: memory, context7, grep_app, websearch - External SSH connections to remote VPS servers - LSP servers enabled: deno, typescript, vue, eslint, oxlint, biome, gopls, ruby-lsp, pyright, and 15+ others Errors Observed in Logs: ``` ERROR service=mcp clientName=memory error=MCP error -32601: Method not found failed to get prompts ERROR service=mcp clientName=context7 error=MCP error -32601: Method not found failed to get prompts ERROR service=mcp clientName=grep_app error=MCP error -32601: Method not found failed to get prompts ``` Memory Configuration References Found: - max_memory_restart: '2G' (observed in logs) ### Additional Context - Process was running for an extended period with multiple parallel agent operations - System recovered after the resource exhaustion event - Current opencode processes (post-restart) show normal memory usage (~800MB - 1.9GB) - Log file from incident: `2026-02-03T002133.log` (31MB, created at 6:38 PM) ### Steps to Reproduce Unknown - occurred during normal usage with multiple agents and MCP tools active. ### Expected Behavior Memory usage should remain stable and not grow unbounded, especially with max_memory_restart configured. ### Actual Behavior Virtual memory consumption grew to 113.4 GB despite 2G memory restart configuration, causing system-wide memory exhaustion. ### Severity 🔴 CRITICAL - System stability impact, potential data loss from forced program closures ### Possible Related Issues - MCP error -32601 may indicate protocol issues contributing to memory leak - Multiple concurrent agent sessions may not be properly releasing memory - Memory restart limit (2G) not being enforced or ineffective --- Reported by: Sisyphus (Kimi k 2.5) on behalf of user Investigation Date: 2/2/2026 Incident Date: 2/2/2026 6:36 PM
yindo added the windowsperf labels 2026-02-16 18:09:49 -05:00
yindo closed this issue 2026-02-16 18:09:49 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #9743: Memory Leak: OpenCode Process Killed by OOM Killer During Extended Runtime (112.4GB virtual memory - nearly identical scenario)
  • #5363: opencode eating 70gb of memory (70GB virtual memory in long-running sessions)
  • #6119: TUI fails to render with raw ANSI output and critical memory leak (72.5GB VIRT on startup)
  • #7261: v1.1.6 still has memory bloat (485GB virtual memory, MCP orphan processes not cleaned up)
  • #10913: fix: multiple memory leaks in long-running sessions (AsyncQueue, bash tool, LSP diagnostics Map issues)
  • #11399: opencode memory usage keeps growing over time (Continuous memory growth to 10-15GB+)
  • #10563: Memory Leak: Orphaned processes when terminal closes (41 processes, 3GB+ wasted memory)
  • #9140: Memory leak: Unbounded caches grow without limit (Instance cache, Provider SDK cache)

Feel free to ignore if none of these address your specific case. These issues collectively indicate systemic resource management and cleanup problems that may be contributing factors.

@github-actions[bot] commented on GitHub (Feb 2, 2026): This issue might be a duplicate of existing issues. Please check: - #9743: Memory Leak: OpenCode Process Killed by OOM Killer During Extended Runtime (112.4GB virtual memory - nearly identical scenario) - #5363: opencode eating 70gb of memory (70GB virtual memory in long-running sessions) - #6119: TUI fails to render with raw ANSI output and critical memory leak (72.5GB VIRT on startup) - #7261: v1.1.6 still has memory bloat (485GB virtual memory, MCP orphan processes not cleaned up) - #10913: fix: multiple memory leaks in long-running sessions (AsyncQueue, bash tool, LSP diagnostics Map issues) - #11399: opencode memory usage keeps growing over time (Continuous memory growth to 10-15GB+) - #10563: Memory Leak: Orphaned processes when terminal closes (41 processes, 3GB+ wasted memory) - #9140: Memory leak: Unbounded caches grow without limit (Instance cache, Provider SDK cache) Feel free to ignore if none of these address your specific case. These issues collectively indicate systemic resource management and cleanup problems that may be contributing factors.
Author
Owner

@KaranjotVendal commented on GitHub (Feb 2, 2026):

I believe I have encountered the same issue. Seems like the following PR #11717 and PR #10914 seems to be fixing the solution.

Image

@KaranjotVendal commented on GitHub (Feb 2, 2026): I believe I have encountered the same issue. Seems like the following PR #11717 and PR #10914 seems to be fixing the solution. ![Image](https://github.com/user-attachments/assets/93533551-0a85-4747-852e-51f6f742a844)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8377