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.
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:
Assertion failures triggered by the WAL-Reset bug.
Then I repeated the exercise with 3.51.3, with the same workload and Antithesis instrumentation. Sure enough, the run came back green.
3.51.3 comes back clean.
... continue reading