Skip to content

fix(server): enable wal and busy timeout on runtime sqlite - #7782

Open
sentry[bot] wants to merge 2 commits into
devfrom
seer/fix-runtime-sqlite-locking
Open

sentry[bot] wants to merge 2 commits into
devfrom
seer/fix-runtime-sqlite-locking

Conversation

@sentry

@sentry sentry Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What is this about?

What problem does it solve?

Concurrent operations on runtime.sqlite make workspace KV read endpoints (such as GET /workspace/:id/default-model) fail with SQLite's SQLITE_BUSY ("database is locked"). Several parts of the server open connections to this file: workspace KV stores, v2 session homes, and read-only config stores. Their connections used the default rollback journal, where writers block readers, and no busy timeout, so lock contention failed immediately instead of waiting.

What was the situation before?

Setting Before After
Journal mode Rollback (default): writers block readers WAL: readers and writers can overlap
Busy timeout None: lock contention fails at once 5000 ms: waits for the lock
Synchronous Default NORMAL

How is this implemented?

  • apps/server/src/runtime-db.ts exports RUNTIME_SQLITE_BUSY_TIMEOUT_MS (5000 ms), applyRuntimeSqliteBusyTimeout, and configureRuntimeSqlite.
  • Writable runtime SQLite instances (Bun and Node) are configured with PRAGMA busy_timeout = 5000, PRAGMA journal_mode = WAL, and PRAGMA synchronous = NORMAL.
  • apps/server/src/workspace-kv-store.ts: read-only fallback connections use applyRuntimeSqliteBusyTimeout.

What else changed?

  • Code kept comment-free to follow the repo's no-new-comment rule.

Release note

Fixed workspace settings reads failing with "database is locked" when several operations run at once.

Evidence

  • Regression test apps/server/test/workspace-kv-store-locking.test.ts: concurrent reads succeed while another connection holds an exclusive transaction.

Fixes DESKTOP-APP-4V

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.

@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Nov 26, 2026 11:02am UTC
openwork-den Skipped Skipped Nov 26, 2026 11:02am UTC
openwork-landing Skipped Skipped Nov 26, 2026 11:02am UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – openwork-app November 26, 2026 10:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den November 26, 2026 10:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing November 26, 2026 10:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing November 26, 2026 11:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app November 26, 2026 11:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den November 26, 2026 11:02 Inactive

This branch was previously deployed

3 inactive deployments
Preview – openwork-landing — 68034f3c Deployed Nov 26, 2026 by vercel[bot]
Preview – openwork-app — 68034f3c Deployed Nov 26, 2026 by vercel[bot]
Preview – openwork-den — 68034f3c Deployed Nov 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants