7 comments

  • calmingsolitude 2 minutes ago

    Well written post, really enjoyed reading it.

    > A single Go process exclusively accesses that database, and serves the control plane for those tailnets. This single-writer design is exactly how SQLite is meant to be used.

    This line led me to believe that the writer and checkpointing logic lived on the same database connection, so I was curious to find out how the data race occurred. However, the bug details on the SQLite page[0] outline that it can only ever occur if there are multiple connections open, so the writer and the checkpointer being on different threads led to the data race.

    [0] https://sqlite.org/wal.html#the_wal_reset_bug

  • simonw 18 minutes ago

    > We funded the open-source SQLite VFS shim that helped isolate the race condition almost immediately, and will help track down similar bugs in the future.

    Interesting example of a company funding open source - in this case paying for the development of a new and very specific debugging tool.

      binhex 13 minutes ago

      Yeah, tailscale seems to have leadership with their head on right, I agree with the way they handle a lot of things.

        saghm 9 minutes ago

        Yeah, this part also stuck out to me:

        > Because this wouldn’t be a quick or easy fix, we reached out to the SQLite developers for a professional support contract. This was a great decision. It gave us direct access to their deep expertise and experience, and we had many detailed technical conversations about our architecture and our incidents.

        They were willing to pay to get help solving the problem, and then pay again to make sure that the problem is easier to avoid in the future! That kind of long-term thinking seems pretty rare nowadays...

        devmor 10 minutes ago

        Their CEO is a very nice and personable guy too. Has given me and others advice on random topics of his interest with no nonsense plenty of times.

  • bobtheborg 7 minutes ago

    Great read. So glad they took the time to tell this story. (And glad they, as a for profit corporation, took out a support contract with SQLite. I hope they continue to do so even though this problem is resolved.)

  • dolmen 10 minutes ago

    Which SQLite driver for Go does Tailscale use?