Skip to content

[Bug] OpenCode TUI freezes intermittently on WSL2 (input buffered), traced to Node.js v25.8 JIT generating SIGILL causing WSL kernel crashes #18132

Closed as not planned

Description

@BHQM-123

Description

OS: Windows 10 (build 19045.4412) with WSL2

WSL Distribution: Ubuntu 22.04 / 24.04 LTS (fresh install)

Hardware: MAXSUN B450M motherboard, AMD Ryzen 5 5500 CPU

Node.js: v25.8.0 (problematic) / v22.22.1 (fixed)

OpenCode Version: 1.2.27

Model Provider: China Unicom Yuanjing (GLM-5), API endpoint https://maas-api.ai-yuanjing.com/openapi/compatible-mode/v1/chat/completions

Problem Description
The OpenCode TUI version randomly freezes during normal use. The interface becomes completely unresponsive, but keyboard input is buffered—characters typed during the freeze appear all at once after recovery. Freezes last from seconds to minutes and occur unpredictably.

Key findings:

A friend with identical software configuration (same Node.js version, same API key) does not experience the issue.

OpenCode Web (opencode web) runs smoothly without freezes.

The problem persists even in a fresh Ubuntu 24.04 installation.

Tried Solutions (Ineffective)
1.Reinstalling WSL2 and Ubuntu (fresh 24.04 install)

  1. Changing terminals (Windows Terminal, VS Code terminal, native wsl)

  2. Disabling IPv6

  3. Increasing WSL2 memory limit (.wslconfig with 8GB)

  4. Clearing OpenCode cache (rm -rf ~/.cache/opencode)

  5. Testing with the same API key on a friend's machine (no issues there)

  6. Final Solution (Effective)

Downgrading to Node.js LTS (v22.22.1) completely resolved the issue:

bash
nvm install 22
nvm alias default 22
npm install -g opencode-ai
After this change, OpenCode runs smoothly without freezes, and no new crash dumps appear in wsl-crashes.

Root Cause Hypothesis
Node.js v25.8's JIT compiler, on certain CPUs (including AMD Ryzen 5 5500), generates illegal instructions (SIGILL).

OpenCode executing these instructions triggers a SIGILL from the Linux kernel.

The WSL2 kernel crashes, and the Windows WSL service automatically restarts the VM.

During the restart, the TUI freezes, but Windows terminal input buffering preserves typed characters.

After recovery, buffered input is "replayed," giving the illusion of input buffering.

The friend's CPU (likely newer or with a different instruction set) does not trigger this JIT bug

Recommendations
1.Document that WSL2 users should prefer Node.js LTS versions (v20/v22).

2.Consider a startup check to warn users if a non-LTS Node.js version is detected.

3.Improve error handling to gracefully recover from illegal instructions instead of crashing.

Plugins

not

OpenCode version

1.2.27

Steps to reproduce

1.Install Node.js v25.8.0 and OpenCode in WSL2.

2.Configure any model (e.g., China Unicom GLM-5).

3.Start a conversation and send several messages.

4.Wait for a random freeze (may occur after 2–3 messages or 10+).

Screenshot and/or share link

debug.txt

Operating System

Windows 10 (build 19045.4412) with WSL2

Terminal

Windows Terminal, VS Code terminal, native wsl

Activity

  1. github-actions commented on Mar 18, 2026

    @github-actions
    Contributor

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

    If your issue is distinct (e.g., specifically caused by Node.js v25 JIT/SIGILL rather than other root causes), please clarify how it differs from the above.

  2. BHQM-123 commented on Mar 18, 2026

    @BHQM-123
    Author

    Thanks for the references. I’ve looked through them, but my problem is specifically caused by Node.js v25.8’s JIT compiler generating illegal instructions (SIGILL) on my AMD CPU, which leads to WSL2 kernel crashes. This was confirmed by WinDbg analysis of the crash dumps. Switching to Node.js v22 LTS completely resolved the issue. The other linked issues don’t mention this JIT-related root cause.
    I submitted this issue to help others who might encounter the same problem, especially those using similar hardware (MAXSUN B450M + Ryzen 5 5500). The other linked issues do not mention this specific JIT-related cause.

    Hope this helps!╮(╯▽╰)╭

  3. xiangyangy commented on Apr 15, 2026

    @xiangyangy

    环境信息

    ┌──────────┬──────────────────────────────────────┐
    │ 项目 │ 值 │
    ├──────────┼──────────────────────────────────────┤
    │ OS │ Windows 11 + WSL2 (Ubuntu 24.04 LTS) │
    ├──────────┼──────────────────────────────────────┤
    │ 内核 │ 5.15.167.4-microsoft-standard-WSL2 │
    ├──────────┼──────────────────────────────────────┤
    │ 终端 │ Windows Terminal │
    ├──────────┼──────────────────────────────────────┤
    │ opencode │ 1.4.6 (npm, Bun-compiled binary) │
    ├──────────┼──────────────────────────────────────┤
    │ Node.js │ v22.22.1 │
    └──────────┴──────────────────────────────────────┘

    具体表现

    • TUI 启动后完全卡死,无任何输出,键盘输入无响应
    • 进程保持运行状态(S 或 D),但不响应任何输入
    • web serve 模式在浏览器中白屏/加载失败

    已排查内容

    1. strace 追踪确认:ioctl(0, TCGETS) 返回 ENOTTY,stdin 不被识别为 TTY
    2. 进程状态:曾出现 p9_client_rpc disk sleep(D 状态),卡在 /mnt/c 9p 文件系统调用
    3. 对比测试:claude (Node.js) 和 hermes (Python) TUI 均正常运行
    4. 尝试方案均无效:timesyncd → chrony、tmux wrapper、Python pty wrapper、--pure 模式、版本升级(1.4.4 → 1.4.6)

    根因判断

    opencode 使用 Bun 编译(JSC 引擎),Bun 在 WSL2 下的 TTY 交互存在兼容性问题,与 Node.js 运行时不同。参考
    https://github.com/oven-sh/bun/issues/7632。


  4. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions