{
  "slug": "checkpoint-starvation",
  "term": "Checkpoint starvation",
  "aliases": [
    "SQLite WAL checkpoint starvation"
  ],
  "definition": "Checkpoint starvation is sustained inability to finish or reset a database log checkpoint because the required progress conditions keep being obstructed.",
  "note": "In SQLite WAL, retained reader snapshots can constrain backfill and recycling while later writes continue. [sqlite-wal] A two-case observation separates a pinned transaction from an idle open connection; it is not a production failure-rate study. [hesela-observation] A PASSIVE result can report busy=0 with fewer checkpointed frames than current log frames. [sqlite-checkpoint-pragma]\n\nA completed or cancelled backup can leave a source read that the caller opened earlier. In 84 synthetic runs on two builds, that read retained WAL history after backup cleanup; a reader-only control did the same. BEGIN alone did not pin a read between steps. Per-schema transaction state distinguishes it from BEGIN plus SELECT. [retention-data] [txn-state]\n\njournal_size_limit=0 did not cap the live WAL in those fixtures: required frames remained until the owned read ended. The setting controls retained file size around reset, not an unconditional quota. File length is not physical I/O or a timing measurement. [journal-limit] [retention]\n\nEnding starvation is not history erasure. In a separate SQLite 3.45.1 deletion fixture with core secure_delete ON, a pinned reader caused a busy TRUNCATE result. After reader release, FULL and RESTART completed but retained the deleted token in the WAL. Successful TRUNCATE shortened that logical file to zero; an earlier backup still returned the original row. These are stages of one controlled lifecycle, not independent trials or a media-sanitization test. [deletion-data]\n\nRESTART prepares the log for reuse by the next writer; TRUNCATE additionally shortens it on success. Historical WAL bytes need not survive reuse indefinitely. Do not delete a live WAL manually. [deletion-contract] [sqlite-wal]\n\nclose_v2 can retain a reader. [close-lifecycle-contract]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    {
      "text": "A large WAL file alone does not identify starvation; file length can remain high after progress.",
      "citationIds": [
        "sqlite-wal"
      ]
    },
    {
      "text": "Checkpoint counters include earlier backfill, not just new work per call.",
      "citationIds": [
        "deletion-contract"
      ]
    },
    {
      "text": "WAL frame validity requires matching salts and cumulative checksums; stored residue alone does not establish replay eligibility.",
      "citationIds": [
        "deletion-wal-format"
      ]
    },
    {
      "text": "An unfinalized statement can delay destruction without pinning a snapshot: unstepped, drained and reset SELECT controls allowed TRUNCATE in the recorded fixtures.",
      "citationIds": [
        "close-lifecycle-data"
      ]
    }
  ],
  "related": [
    "database-checkpoint",
    "write-ahead-log",
    "sqlite-wal-end-mark",
    "sqlite-online-backup",
    "sqlite-transaction-state",
    "sqlite-snapshot-handle"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "sqlite-wal",
      "title": "SQLite: Write-Ahead Logging, sections 2, 6 and 11",
      "url": "https://www.sqlite.org/wal.html",
      "accessed": "2026-10-14"
    },
    {
      "id": "sqlite-checkpoint-pragma",
      "title": "SQLite: PRAGMA wal_checkpoint, three-column result",
      "url": "https://www.sqlite.org/pragma.html#pragma_wal_checkpoint",
      "accessed": "2026-10-14"
    },
    {
      "id": "hesela-readers",
      "title": "SQLite WAL checkpoint starvation: success is not completion",
      "url": "https://hesela.com/analyses/sqlite-wal-checkpoint-starvation/",
      "accessed": "2026-10-14"
    },
    {
      "id": "hesela-observation",
      "title": "Hesela: measured SQLite WAL-reader observations and limits",
      "url": "https://hesela.dev/research/sqlite-wal-readers.json",
      "accessed": "2026-10-14"
    },
    {
      "id": "retention-data",
      "title": "Hesela: two-build source-read retention experiment, derived summary and receipt hashes",
      "url": "https://hesela.dev/research/sqlite-backup-retention/summary.json",
      "accessed": "2026-10-21"
    },
    {
      "id": "journal-limit",
      "title": "SQLite: PRAGMA journal_size_limit, retained file size and reset",
      "url": "https://sqlite.org/pragma.html#pragma_journal_size_limit",
      "accessed": "2026-10-21"
    },
    {
      "id": "txn-state",
      "title": "SQLite: per-schema transaction state",
      "url": "https://sqlite.org/c3ref/txn_state.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "retention",
      "title": "Hesela: source-read ownership after backup cleanup, method and limitations",
      "url": "https://hesela.com/analyses/backup-verification-is-not-a-restore-test/#sqlite-backup-retention",
      "accessed": "2026-10-21"
    },
    {
      "id": "deletion-contract",
      "title": "SQLite: checkpoint modes, completion and truncation",
      "url": "https://www.sqlite.org/c3ref/wal_checkpoint_v2.html",
      "accessed": "2026-10-30"
    },
    {
      "id": "deletion-data",
      "title": "Hesela: generated SQLite deletion observations, two retained runs and explicit limits",
      "url": "https://hesela.dev/research/sqlite-deletion-scope/summary.json",
      "accessed": "2026-10-30"
    },
    {
      "id": "deletion-package",
      "title": "Hesela: standalone SQLite deletion evidence, code and 42 raw files",
      "url": "https://hesela.dev/research/sqlite-deletion-scope/package.zip",
      "accessed": "2026-10-30"
    },
    {
      "id": "deletion-wal-format",
      "title": "SQLite Database File Format: WAL frame validity and reset (sections 4.1 and 4.4)",
      "url": "https://sqlite.org/fileformat2.html#walreset",
      "accessed": "2026-10-30"
    },
    {
      "id": "close-lifecycle-contract",
      "title": "SQLite C API: closing a connection and deferred destruction",
      "url": "https://sqlite.org/c3ref/close.html",
      "accessed": "2026-11-09"
    },
    {
      "id": "close-lifecycle-data",
      "title": "Hesela: twelve native close-lifecycle schedules on each of two SQLite builds",
      "url": "https://hesela.dev/research/sqlite-close-lifecycle/summary.json",
      "accessed": "2026-11-09"
    },
    {
      "id": "close-lifecycle-package",
      "title": "Hesela: SQLite close-lifecycle sources, raw observations and replay code",
      "url": "https://hesela.dev/research/sqlite-close-lifecycle/package.zip",
      "accessed": "2026-11-09"
    },
    {
      "id": "close-native-data",
      "title": "Hesela: separate native C verification of the existing close-lifecycle schedules",
      "url": "https://hesela.dev/research/sqlite-close-native-verification/summary.json",
      "accessed": "2026-11-09"
    },
    {
      "id": "close-native-package",
      "title": "Hesela: both close-lifecycle observers, retained results and source snapshots",
      "url": "https://hesela.dev/research/sqlite-close-native-verification/package.zip",
      "accessed": "2026-11-09"
    }
  ],
  "updated": "2026-11-28",
  "provenance": [
    "The deletion fixture does not run a subsequent writer/reset; residue after reuse was not measured. [deletion-data]",
    "Twelve native C-API schedules per build on SQLite 3.45.1 and 3.54.1; an active SELECT prevented TRUNCATE completion after close_v2 returned OK. No crash, performance or failure-rate measurement. [close-lifecycle-data]",
    "A separate C observer matched all 48 executions (12 schedules, two recorded engine binaries, two harness compiler modes). Same host and binaries, with the earlier packet visible; not external peer review, field samples or power-loss evidence. [close-native-data]"
  ]
}
