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

未关闭
#2,271 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 11 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
c, rust, sqlite
领域
databases

调研方向

首先定位 libsql-ffi crates 中打包的 SQLite 源码和随附的 sqlite3.h,然后将打包的 checkpoint 路径与 SQLite 3.51.3 的 WAL-reset 修复进行比较。使用所描述的并发写入者、外部 WAL checkpoint、已提交键断言以及 integrity_check 轮次验证此次更新或 backport。

由索引模型根据 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 小时
30 天内合并 PR
1

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

tursodatabase/libsql 的其他 Issue

查看 tursodatabase/libsql 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。