Breaking the WAL

(antithesis.com)

23 points | by wwilson 1 hour ago

7 comments

  • carlsverre 32 minutes ago
    Hi! I'm the author and the person who was on a road trip when I decided to do this experiment back in July. I'm super excited to finally get the blog post out, and even better, alongside a post describing the root cause process that went into the project. You can read about Tailscale's story here: https://tailscale.com/blog/sqlite-wal-reset-bug

    I'm only sad that I didn't put SQLite under test earlier in the year, or I would have found this issue right away. If you look at the workload[1], you can see how simple it is. Exactly the same kind of workload we write every day to help our customers find bugs.

    If you have any questions about our process or how debugging with Antithesis works, please let me know! Thanks for reading!

    [1]: https://github.com/antithesishq/sqlite/blob/3.51.2-instrumen...

    • MPSimmons 15 minutes ago
      How difficult would it have been to isolate that problem if you didn't already know the SQLite subsystem it was in? This feels, to someone relatively ignorant of the SQLite / Tailscale / Antithesis architectures as a "hindsight is 20/20" kind of thing, but I'm open to learning more.
      • carlsverre 9 minutes ago
        Great question! The general approach we take with transactional systems like this is to put reachability statements throughout the complex stateful machinery and then stress-test them in Antithesis.

        The workload I put in place does exactly that[1]. It runs a write workload from multiple processes concurrently on the same SQLite database to cause writes to build up in the WAL, and runs checkpoints concurrently. This exercises the portion of the WAL code that, from a trivial read-through, is most likely to contain bugs (and turns out, did!).

        Said differently, this is exactly the approach we take with all stateful transactional systems. I am only sad that I didn't do this experiment months earlier, as it would have saved Tailscale and the SQLite team a lot of time.

        [1]: https://github.com/antithesishq/sqlite/blob/3.51.2-instrumen...

  • wwilson 44 minutes ago
    We wanted to publish this ASAP since people are talking about this bug today. In a follow-up, we will show how our automated causality analysis could have saved Tailscale and SQLite from 6 months of root cause analysis. Stay tuned!
  • minimaltom 23 minutes ago
    I went clicking through to see if I could find the prompt they fed the AI to locate the issue / write the test suite.

    I couldn't find it, so its unclear if the prompt was completely "make a test suite" or was lead towards finding it in the first place, which wouldn't be a fair test.

    The closest I mention of the prompt I could find was:

    > Then I asked it to write a simple workload which exercised the WAL insert and checkpoint code. Notably, this is a completely generic workload.

    With a skeptical lens, unclear.

    • carlsverre 14 minutes ago
      Hey, author here! Good question. The prompt was to use the Antithesis skills[1] to write a workload that exercises SQLite's insertion and checkpoint machinery across multiple processes using a specific version of SQLite (3.51.2). The agent who did the work was aware of the bug and knew I wanted to see if Antithesis could reproduce it. However, I specifically designed the workload the same way we approach testing other WAL checkpoint-style systems: by putting them under stress. The workload itself does not know about the bug.

      My goal, which I believe I accomplished, was to determine if Antithesis would have found this bug if we had put the SQLite WAL under test.

      [1]: https://github.com/antithesishq/antithesis-skills

      • minimaltom 12 minutes ago
        Thanks for clarifying! It would be really interesting if Antithesis finds the bug when:

        1. The specific bug isnt mentioned 2. (If youre game) a model with a knowledge-cutoff date before the report is used

    • gamegoblin 17 minutes ago
      Their founder guy says[1] they found some other bugs while doing this that they will report soon, so if that is true, seems more plausibly like a pretty generic thing.

      Looking forward to seeing the other bugs they found.

      1. https://news.ycombinator.com/item?id=49278351

  • john_strinlai 47 minutes ago
    related: Tailscale Traces Database Corruption to 16y/o SQLite WAL-Reset Bug (tailscale.com) https://news.ycombinator.com/item?id=49272832
  • grebc 41 minutes ago
    Worst ad I’ve ever read.

    Wow, with prior knowledge of a bug our tool found it too!

    Great work pal, I’m sure the phone is gonna ring off the hook.

    • carlsverre 37 minutes ago
      Carl (author) here. This is a poor reading of the blog post. Notably, I built a general-purpose workload that simply exercises the write/checkpoint machinery. The exact same workload we use to break all kinds of transactional systems. This generic workload found the bug without any special knowledge of the bug, due to how Antithesis works.
      • returningfory2 14 minutes ago
        I think the issue is that you knew there was a bug to be found in the write and checkpoint interactions, which then determined which workload you built.

        My understanding is that this workload is very uncommon: the Tailscale blog says they used a custom unusual configuration to have many checkpoints like this. So without knowing the bug, it seems unlikely one would build this workload and then find the bug. If that makes sense.

        Edit: just want to say that you being able to repro it is awesome, but that the overall claim seems a little overstated to me.

      • grebc 33 minutes ago
        I read your ad.

        It states you replicated the bug once the SQLite team fixed it, and published it.

        Not sure what’s difficult about replicating behaviour when it’s spelled out for you.

        • biorach 29 minutes ago
          this is a deliberate mischaracterisation of the content of the article
          • grebc 15 minutes ago
            You’re mischaracterising an ad, that’s also funnily enough full of it.
    • wwilson 38 minutes ago
      As the post (and linked repo) pretty clearly indicate, zero info about the existence of the bug went into this work.

      Oh btw, we also found some other ones… Stay tuned!

      • grebc 36 minutes ago
        So you found this before SQLite published the fix?