Live data from Hacker News

Tracking down the 16-year-old WAL-reset SQLite bug

tailscale.com

201–210 of 263 posts

Re: Tracking down the 16-year-old WAL-reset SQLite bug

#201
post #35

SQLite: 92 million lines of tests Dijkstra: Tests can only prove the presence of bugs, never their absence!

The idea of testing is to sample and test the paths you care about, mostly business workflows, not to enumerate infinite combinations.

It's an art to come up with a great test suite that covers just enough and minimizes overlap, not only survives but also helps with refactoring.

Re: Tracking down the 16-year-old WAL-reset SQLite bug

#203
post #59

Earlier quoted context omitted.

I've been a fan of Tailscale since encountering it for the first time at a previous job at a small startup. Someone asked if anyone had a Linux machine when we were all testing out something, and I mentioned I had a personal Linux desktop but wasn't sure how to connect it to the VPN for access, and it turned out that the solution was just literally running two commands in the terminal after installing tailscale from…

That strongswan thing is the kind of design HN praises about open protocols by IRC (just the other day...) but in practice is so flexible it can't keep itself upright and it's unusable in practice. Meanwhile tailscale or wireguard, by being actually opinionated, avoids needing much configuration at both ends.

Yes — configuring strongSwan as a bog-standard VPN server was so hard to fathom I made GitHub repo for it [1]. To be fair, some of the complexity comes from OS support that seems specifically designed to make secure setups difficult, presumably at the behest of various Three Letter Agencies.

I have now mostly switched to Wireguard for this, which is much more sane [2].

[1] https://github.com/jawj/IKEv2-setup [2] https://github.com/jawj/wireguard-setup

Re: Tracking down the 16-year-old WAL-reset SQLite bug

#204

Earlier quoted context omitted.

How about having devices generate and not share their private keys, instead?

That's already how it works at the data-plane layer. I'm talking about the control-plane layer where tailscale needs to maintain a server that gets its state from somewhere (they need to know where to route your data, what your permissions ACLs are, device names, etc.). If everyone shared the same db cluster accessed over the network there is a real risk of an accident leaking the encryption keys (of the database its…

Is it? They're backing them all up to S3 so what if the S3 keys leak?

Re: Tracking down the 16-year-old WAL-reset SQLite bug

#206

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 SQ…

I don't know enough about the scale of Tailscale's operations to comment strongly on this, but if they're fairly significant shouldn't that have read "is exactly how MariaDB is meant to be used" or "exactly how Postgres is meant to be used"? SQLite has a "lite" in the name for a reason, but it's often pushed into places where it's being asked to do things it was never really designed for.

> SQLite has a "lite" in the name for a reason

It"s actually SQL "ite" as in rocks, minerals and fossils. Their version control system is called "Fossil".

Re: Tracking down the 16-year-old WAL-reset SQLite bug

#207
post #80

Earlier quoted context omitted.

Wow, that’s a great idea! I loved keybase back in the day and really thought it solved a real world problem in a unique and interesting way. Then Zoom bought it (for some reason) and left it to rot.

You might already know and used "for some reason" as sarcasm. For those that do not: Zoom did the usual aqui-hire. They needed to show their enterprise customers they were taking e2e encryption seriously, so they bought out the guys who did exactly that kind of encryption with Keybase. A shame really, because Keybase was kind of unique in the way the facilitated social proof of identity tied to cryptographic keys. A…

the UX was so terrible that it was inevitable it won't stick. It was clunky and alien on every productivity platform, I attempted to work in a team leveraging it, and it was painful on windows and macos alike.

I just deleted it as I noticed it was responsible of about 30% of active cpu (and battery drain) usage on my mac, while being logged out due to inactivity. Honestly: I never particularly liked it, and I could not feel the concept especially tempting, just went with the team.

Re: Tracking down the 16-year-old WAL-reset SQLite bug

#209
post #195

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 SQ…

> The bug only affects databases in WAL mode when there are two or more database connections open on the same file, in separate threads or processes To be honest, I'm surprised that someone using SQLite would try to access it directly from multiple threads or processes without fear of data racing.

> Multiple processes can have the same database open at the same time. Multiple processes can be doing a SELECT at the same time. But only one process can be making changes to the database at any moment in time, however.

https://sqlite.org/faq.html#q5

One writer, multiple readers is a specifically supported way of using SQLite.

Why should you be worried if it is used as designed?

Re: Tracking down the 16-year-old WAL-reset SQLite bug

#210
post #144
post #3

Earlier quoted context omitted.

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

At least for now. All it takes is one greedy executive decision to stop supporting headscale. Given it’s an American company, it’s entirely possible.

Tailscale is Canadian, headquartered in Toronto.
Post reply on HN