Tailscale traced a database corruption bug to a 16-year-old flaw in SQLite
Translated by a model; the original is in Russian.
Tailscale, the company behind the WireGuard-based network of the same name, has described an investigation that led it to a long-standing bug in SQLite — one of the most widely used embedded database engines in the world.
According to the write-up, its engineers ran into a database corruption and, while getting to the bottom of it, tracked the problem down to a defect in the mechanism that resets the write-ahead log (WAL). Judging by the description, the bug had gone unnoticed for about sixteen years.
WAL is a journaling mode in which changes are first written to a separate log and only later moved into the main database file. This approach improves performance and resilience to failures, but it was precisely during the log-reset stage that the problem the Tailscale team managed to pin down showed up.
The story is telling in how long defects can stay hidden even in mature and extremely widely used code: SQLite runs in browsers, mobile apps, operating systems and a host of server-side services, so rare edge cases surface only under an enormous volume of real-world use. The write-up drew notable attention on Hacker News, gathering more than four hundred votes and dozens of comments.
The details of the reproduction and the nature of the bug are laid out in Tailscale's original article.
Source: Hacker News
Comments
Sign in, to comment.