Bundled SQLite core predates the 3.51.3 WAL-reset fix (silent loss of committed writes under concurrent checkpointing)

オープン
#2,271 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 11 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
c, rust, sqlite
領域
databases

調査の方向性

まず、libsql-ffi crates に含まれている SQLite ソースと同梱された sqlite3.h を見つけ、次に、同梱されたチェックポイントパスを SQLite 3.51.3 の WAL-reset 修正と比較します。説明されている同時書き込み、外部 WAL チェックポイント処理、コミット済みキーのアサーション、integrity_check のラウンドを使って、更新またはバックポートを検証します。

索引モデルが issue の本文から書いたものです。

説明

Summary

The SQLite core bundled in libsql-ffi predates the upstream fix for the WAL-reset race — the ~16-year-old bug where a write transaction racing a checkpoint during WAL reset confuses the checkpointer about which pages were copied, so committed writes are silently lost or the database corrupts. Upstream SQLite fixed it in 3.51.3.

Versions checked (by reading the shipped sqlite3.h in the crates, 2026-08-12):

  • libsql-ffi 0.9.30 → bundled SQLITE_VERSION "3.45.1" — pre-fix
  • libsql-ffi 0.10.0-pre.4 → bundled 3.47.0 — still pre-fix

As far as I can tell there is no libsql release carrying the fix.

Why this matters to libsql users specifically

The triggering topology is a separate process checkpointing while other connections write — exactly the shape of running Litestream (or any external checkpointer) against a WAL database. That is a common libsql/sqlite deployment pattern. It is a tight-timing race, but Tailscale hit it repeatedly in production over six months, and Antithesis reproduced it deterministically in ~15 minutes.

Sources:

Ask

Rebase the bundled core to ≥ 3.51.3, or backport the checkpoint-path fix to the currently bundled versions. Happy to provide our reproduction/verification harness methodology if useful: N writer processes through the client, an external process issuing wal_checkpoint(TRUNCATE/RESTART) aggressively, asserting every committed key remains readable plus integrity_check per round. (For what it's worth: on 3.45.1 we did not reproduce the race in bounded runs — expected for a tight-timing bug, and not evidence of safety; the upstream fix plus that harness passing on 3.51.3 is what we ended up trusting.)

主要言語
C
スター
17.3k
フォーク
562
平均マージ
10日 15時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tursodatabase/libsql のほかの issue

tursodatabase/libsql の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。