You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] 100% CPU usage in background opencode-cli serve process on Wayland (WebKitGTK socket drop) #24719
When launching the OpenCode Desktop app on a Linux Wayland environment, the background opencode serve process and the WebKitWebProcess start consuming 100%+ CPU continuously.
Root Cause Analysis:
Strace reveals that the high CPU usage is caused by an infinite epoll_pwait2 busy-waiting loop.
On Linux Wayland (especially KDE), WebKitGTK can silently drop IPC/WebSocket sockets during compositor glitches or focus changes.
When this socket drop occurs, the OpenCode frontend attempts to reconnect immediately without any delay or exponential backoff.
Concurrently, the backend process (opencode-cli serve) fails to properly handle the broken socket. The tight while loops in instance-events.ts and the raw socket pipe logic in http-server.ts do not properly yield or destroy the broken sockets, causing the process to spin infinitely in an epoll_pwait2 loop.
Expected Behavior:
The frontend should implement an exponential backoff strategy for reconnections, and the backend should properly close/cleanup broken sockets and yield the event loop to prevent 100% CPU usage.
Proposed Fix:
Frontend: Add exponential backoff logic for WebSocket reconnections.
Backend: Update the while loops in http-server.ts and instance-events.ts to properly detect socket closures (e.g., catching EPIPE or checking socket state) and ensure the sockets are destroyed and the loop yields properly.
This issue might be a duplicate of existing issues. Please check:
High CPU usage in IDLE on Linux Kubuntu 25.10 #24393: High CPU usage in IDLE on Linux Kubuntu 25.10 — same environment (KDE Plasma Wayland), same symptoms (50-100% CPU on opencode + opencode-cli when idle), includes strace output
If your issue is distinct (e.g., specifically triggered by socket drops rather than a general idle CPU regression), please add details that differentiate it from the above, and consider cross-referencing those issues.
Activity
isac322 commentedon Apr 28, 2026
Related issues for context:
github-actions commentedon Apr 28, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct (e.g., specifically triggered by socket drops rather than a general idle CPU regression), please add details that differentiate it from the above, and consider cross-referencing those issues.
github-actions commentedon Jul 4, 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.