Skip to content

Concurrent VS Code instances still silently crash — busy_timeout=0 still present #38849

Closed as not planned

Description

@AliRezaei-Code

This is a continuation of #21215 and #15188 which were auto-closed due to inactivity. The underlying issue is still present and actively affects VS Code users.

Symptom: Running two or more VS Code windows/workspaces on the same project causes one or more OpenCode instances to silently die mid-session. No error dialog, no crash report — the process just vanishes.

Root cause (confirmed in #21215 and #36775): All OpenCode instances share a single SQLite database at ~/.local/share/opencode/opencode.db with PRAGMA busy_timeout = 0. When multiple processes write concurrently, SQLITE_BUSY fires immediately instead of retrying, and the error is silently swallowed in the streaming pipeline.

Confirmed still present on v1.17.15:

$ sqlite3 ~/.local/share/opencode/opencode.db "PRAGMA busy_timeout"
0

Impact: The VS Code extension design inherently spawns one server process per window, so multi-window workflows hit this constantly. This also affects anyone running opencode run in CI with parallel workers, or running the TUI alongside the desktop app.

Request: The sst/opencode fork already ships busy_timeout = 5000 — a one-line, backward-compatible change. Could this be applied upstream as a stopgap while the per-session DB sharding (#20935) is evaluated?

Environment:

  • OpenCode version: 1.17.15
  • OS: macOS 26.2 (arm64)
  • Using VS Code extension with multiple windows

Activity

  1. github-actions commented on Jul 25, 2026

    @github-actions
    Contributor

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

  2. diegoT3ck commented on Aug 2, 2026

    @diegoT3ck

    Confirmé este mismo root cause con un disparador distinto — sin VS Code de por medio, solo terminal + opencode run.

    Escenario: un proceso opencode quedó suspendido con Ctrl+Z (estado T/Tl en ps, con hijos MCP también suspendidos) durante varios días sin cerrarse. Mientras ese proceso zombi seguía vivo, cualquier sesión nueva de opencode (TUI o opencode run "<prompt>") tenía ~1 de cada 5 intentos que se colgaba indefinidamente sin ningún error visible — el log se detenía justo después de "event connected" y nunca llegaba a crear el step de la sesión.

    Verificación:

    $ ps aux | grep opencode
    diegot3+  20118  0.7  1.1 ... Tl   jul31  24:32 opencode   # suspendido desde hace días
    diegot3+ 190680  2.9  2.3 ... Sl+  11:49   2:02 opencode   # sesión activa
    
    $ fuser ~/.local/share/opencode/opencode.db-wal
    /home/.../opencode.db-wal:  20118 190680
    

    Ambos PIDs (el zombi suspendido y el proceso activo) tenían el -wal abierto simultáneamente. Al matar el proceso zombi (kill 20118), el lock se liberó (fuser deja de reportar nada) y 8/8 pruebas posteriores con los mismos prompts que antes fallaban respondieron correctamente y de forma consistente (~7-11s cada una).

    Descarté que fuera un problema de contenido/longitud del prompt: probé variando número de palabras, presencia de ?, con/sin comillas — el fallo era puramente intermitente y correlacionaba 100% con la presencia del proceso zombi reteniendo el WAL, no con el prompt en sí.

    Esto sugiere que el fix de busy_timeout propuesto aquí (o el fork sst/opencode con busy_timeout=5000) resolvería también este caso — cualquier escenario con 2+ procesos opencode abiertos sobre el mismo opencode.db (multi-ventana VS Code, terminal + proceso suspendido, opencode run en paralelo, etc.) parece compartir la misma causa raíz.

    Entorno:

    • OpenCode version: 1.18.10
    • OS: Ubuntu (Linux 6.8.0-136-generic)
    • Instalación: Homebrew
  3. github-actions commented on Oct 2, 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