打破 WAL
Breaking the WAL

原始链接: https://antithesis.com/blog/2026/wal-reset-bug/

Carl 是利用 Antithesis 测试 AI 驱动代码的开发者。他成功利用 Claude 识别并验证了 SQLite 中一个困扰开发者多年的“传奇”数据竞争漏洞(WAL-Reset 漏洞)。 此前,SQLite 团队和 Tailscale 曾花费数月时间试图定位并修复这一棘手问题,期间不仅需要复杂的自定义调试工具,还进行了漫长的测试。而 Carl 仅用约一小时就完成了这项任务。他仅通过手机向 Claude 下达指令,要求其在 Antithesis 中设置存在缺陷的 SQLite 版本,应用标准完整性断言并运行通用工作负载。Antithesis 在 15 分钟内就捕获了该漏洞,并确认了 3.51.3 版本中的后续修复。 这一演示凸显了软件可靠性测试的巨大飞跃。通过让 AI 智能体利用 Antithesis 等确定性的“时间旅行”调试平台,开发者能够快速找到并验证那些曾经被认为几乎无法重现或解决的“棘手”并发漏洞的根源。这种方法将原本痛苦、耗时数月的调试噩梦转变为快速的自动化流程,为数据库稳定性提供了变革性的解决方案。

Antithesis 近日发布了一篇博文,详细介绍了他们成功复现了一个存在 16 年之久的 SQLite 预写日志(WAL)漏洞的过程。该漏洞近期导致了 Tailscale 的数据库出现严重损坏,Antithesis 通过其自动化测试平台发现了这一问题。 Antithesis 团队强调,他们是利用一套旨在压力测试事务系统的通用自动化工作负载发现该漏洞的,而非针对性地寻找这一已知问题。他们认为,是其平台独立探索状态空间的能力促成了此次发现。 Hacker News 上的讨论引发了争议。尽管作者坚持认为他们的工作证明了其自动化因果分析工具在查找复杂、深层漏洞方面的有效性,但一些社区成员对此持怀疑态度,质疑发布文章的时机,并将其定性为宣传内容。Antithesis 计划发布后续文章,展示其工具如何能为 SQLite 和 Tailscale 团队加速根源分析过程。
相关文章

原文

Hi, it’s Carl again. You may remember me as the guy who taught Claude to use Antithesis.

Earlier this year, SQLite released (3.51.3), which fixed a longstanding bug in their Write-Ahead Logging (WAL) subsystem called the WAL-Reset bug. The bug had been hanging around since 2010, but the SQLite team had apparently been unaware of its existence until earlier this year (more on this below). As they wrote at the time:

“The bug is a data race with tight timing constraints. It is unlikely to occur in common use. The developers have never been able to reproduce the bug organically and had to add special testing logic to SQLite that deliberately triggers the circumstances of the bug in order to verify that the issue has been fixed.”

I was actually on a road trip with my girlfriend when I read about this, but I’m also a giant database nerd, so I was immediately nerd-sniped, hard. Bugs in SQLite, after all, are legendarily rare. Moreover, this sounded like just a perfect brown M&M: a known, challenging bug that we could track down with Antithesis (we’ve done this a lot in our POCs). On top of that, I’d recently shipped our skills for Claude.

So, sitting on a hillside on the Sunshine Coast, I whipped out my phone, and asked Claude to get to work. I had it get SQL 3.51.2 – still buggy – set up in Antithesis, and then instrument the code with a bunch of Antithesis assertions. You can see the instrumented version here.

Shoutout here to my incomparably beautiful home province of British Columbia.

Then I asked it to write a simple workload which exercised the WAL insert and checkpoint code. Notably, this is a completely generic workload. It just runs writes and checkpoints concurrently – things you’d expect to actually happen in production, all the time. The assertions are also generic to the bug, they’re all standard assertions you’d add to any database, things like “no lost committed writes” and “database is not corrupt” (called integrity check in sqlite).

On my first run, Antithesis caught the bug in 15 mins. Here’s the report. The part you’re looking for is:

Then I repeated the exercise with 3.51.3, with the same workload and Antithesis instrumentation. Sure enough, the run came back green.

I thought about this today because Tailscale just wrote an excellent blog post about resolving the uptime issues they’d experienced in 2025. Those issues were how the SQLite team discovered the WAL-Reset bug. Tailscale suffered 6 months of shaky uptime, then they and the SQLite team spent weeks hunting the bug, rolled out and rolled back a fix that broke something else, then had to wait two more months to see if the “real” fix (3.51.3) worked.

To root cause the issue, they had to write a new transaction logging pipeline in Tailscale, then shim in a new debugging tool for the virtual filesystem layer in SQLite. In Antithesis, this process isn’t quite down to a single click, but one click will give you a causality analysis that pinpoints the issue to within a fraction of a second, and deterministic, time-travel debugging that allows you to do what-ifs and destructive analysis.

As the Tailscale team wrote, “nobody wanted us to spend six months looking for bugs in SQLite. This was an immensely frustrating experience for both our customers and staff”.

Finding bugs like the WAL-Reset bug is excruciatingly difficult (perhaps even like crawling over broken glass) – but with rare and difficult bugs, the real torture can come when you’re waiting to see if your fix actually worked. I’ve worked on enough databases, and have experienced this myself many, many times.

So it was both sobering and uplifting to realize just how painful this bug had been in the wild. By giving agents the skills to use Antithesis, I’d just found and verified it in like an hour, from my phone, sitting under spruce trees in the sunshine. I knew our agent skills worked, but I had no idea they worked this well. If you have a gnarly database issue, call me.

联系我们 contact @ memedata.com