Repository navigation
Conversation
…timize SQLite concurrency - packages/core: Configure PRAGMA synchronous = NORMAL and busy_timeout = 10000 on writable SQLite connections. In WAL mode, SQLite defaults to synchronous = FULL, which causes fsync lock stalls on larger journals. NORMAL is crash-resilient with WAL and prevents query lock timeouts. - packages/client: - Increase service probe requestTimeout (2s -> 10s), spawnDelay (5s -> 15s), maxSpawnDelay (30s -> 60s), and promiseTimeout (120s -> 180s) to give busy background servers adequate time to complete queries. - Guard contender recruitment in both Promise and Effect service loops by verifying whether the incumbent PID is alive in the OS process table. Contenders are no longer spawned concurrently while an incumbent server process is running. - Relax event stream defaultIdleTimeout (45s -> 120s) and foregroundIdleThreshold (20s -> 300s) to eliminate false-positive stream drops when switching windows. - packages/desktop: In createSidecarResolver, probe the existing sidecar URL before invoking reconnectService IPC, preventing unnecessary supervisor churn on transient UI stream reconnections. - packages/app: Increase requestStallMs (2s -> 10s) to prevent spurious thrashing warnings during bursty initial session loading.
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
…ase busy_timeout to 30s
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #51216
Type of change
What does this PR do?
On Windows (and systems with high I/O or database load), the desktop app frequently kills its own background service (\opencode-cli) while the service is busy handling transactions or checkpoints, causing a continuous ~60s restart loop, aborted turns (\HTTP 499), and process contention.
Root Causes Identified:
equestTimeout: 2_000\ (2s) and evicted the registered service after 3 consecutive timeouts. A database transaction, WAL checkpoint, or git snapshot blocking the HTTP event loop for just 6.1s caused the supervisor to declare the service unresponsive, SIGTERM/SIGKILL the active PID, delete \service.json, and trigger a restart storm.
egistration.service === undefined\ (e.g. while the server is starting or momentarily saturated), \pool.shouldRecruit(true)\ spawned a contender child process after \spawnDelay: 5_000. Even though the incumbent PID was running in the OS process table, contenders were launched concurrently, racing for database locks and overwriting \service.json.
econnectService()\ IPC unconditionally, re-entering \Service.ensure()\ and accelerating supervisor churn even though the backend process was healthy.
Changes Made:
enderer/startup/initialization.ts):
econnectService()\ IPC. If the incumbent server is responsive, reuse it immediately without triggering supervisor re-checks.
equestTimeout\ (2s -> 10s), \spawnDelay\ (5s -> 15s), \maxSpawnDelay\ (30s -> 60s), and \promiseTimeout\ (120s -> 180s) in \defaultEnsureTiming.
untime/server/request-queue.ts):
equestStallMs\ (2s -> 10s) to prevent false-positive thrashing warnings during initial session loading.
How did you verify your code works?
Screenshots / recordings
Not a UI change.
Checklist