#1536·litestream

Persistent read lock defeats SQLite wal_autocheckpoint under write load

Author: xanisterCreated Sep 22, 2026Updated Sep 22, 2026

Reproduction

Litestream v0.3.13 with a file replica against a WAL-mode SQLite database under a write storm. The writer connection uses PRAGMA wal_autocheckpoint=1000; the Litestream config uses checkpoint-interval: 1m.

Observed WAL trajectory: 18,259,872 bytes max while writing 3,000 1KB rows, then 18,564,752 bytes after the storm. Litestream logged repeated checkpoint: mode=PASSIVE err=database is locked.

Cause

In v0.3.13 db.go opens a long-running read transaction explicitly “to prevent other transactions from checkpointing” (acquireReadLock()), and reacquires it immediately after Litestream checkpoints. This prevents the application writer's SQLite autocheckpoint from progressing during sustained writes, so the WAL grows beyond the configured 1000-page cap.

Expected

Litestream replication should not hold a persistent read mark that defeats the application connection's wal_autocheckpoint. Please advise a supported configuration or release that preserves replication while allowing the normal 1000-page autocheckpoint to keep the WAL bounded.