Skip to content

SQLite busy_timeout should be set on every new connection (not persistent across restarts) #39176

@nishantkabra77

Description

@nishantkabra77

Problem

PRAGMA busy_timeout is a per-connection setting — it resets to 0 on every new SQLite connection. With 10+ concurrent processes (gateway, cron agents, subagents) hitting main.sqlite, a busy_timeout=0 means any concurrent write attempt instantly fails with SQLITE_BUSY instead of retrying.

Context

After an outage on Mar 7, 2026, the root cause was identified as:

  • journal_mode=delete (fixed to WAL — this is persistent)
  • busy_timeout=0 (fixed to 5000 — but this is not persistent)

After gateway restart, busy_timeout reverted to 0, confirmed via:

sqlite3 ~/.openclaw/memory/main.sqlite "PRAGMA busy_timeout;"
# Returns: 0

Expected Behavior

The gateway (and any process opening main.sqlite) should set PRAGMA busy_timeout=5000 on every new connection open, not rely on a one-time manual PRAGMA.

Related

Environment

  • OpenClaw gateway on macOS (arm64)
  • main.sqlite ~798MB
  • 10+ concurrent processes

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions