HN Hall of Fame Weekly email

How to Corrupt an SQLite Database File

Screenshot of sqlite.org captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 6 calendar years, with breakout response in 3 of them.

submissions
9
submitters
9
observed span
2017–2026
peak thread · 148 comments
372 pts
latest 20+ return · 2022-04-30
225 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

In another life (2007) I worked for a company that does digital signage. We had about 8000 systems deployed across the US. The software on them relied heavily on SQLite. At some point we started seeing random corrupted SQLite databases. Trying to figure out what was causing this we realized our pc manufacturer was using the same sku but hardware inside could vary... and in particular the hard drive. Every system with a corrupt DB had a particular brand hard…

I read this as a damnation of POSIX filesystem semantics. File descriptors getting reused, insane locking semantics on close, allowing you to delete an open file and providing no means to prevent it, fork causing problems, unspecified behavior of sync() (is it barrier or "full" sync). Though: Multiple copies of SQLite linked into the same application. Weird and rare scenario, but why not keep the global list of open sqlite files in a global shared memory segment?

zvrba·225-point thread·

I believe that SQLite is a continous source for awe in terms of overall quality of software. Their documentation is spot on, extremely clear and has a very low barrier for entry. Applauds to them and the fantastic job they have been doing in the last decades.

yuchi·104-point thread·

> suppose a multi-thread process has two or more threads with separate SQLite database connections to the same database file. Then a third thread comes along and wants to read something out of that same database file on its own, without using the SQLite library. The third thread does an open(), a read() and then a close(). One would think this would be harmless. But the close() system call caused the locks held on the database by all the other…

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
3

100+ points or 50+ comments

Total points
714

reference only — not used in Hall rules or ranking

Total comments
298

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2017-07-19How to Corrupt an SQLite Database Filepjotrligthart30
2018-03-13How to Corrupt an SQLite Database FileFirst breakoutjeffreyrogers10410
2020-01-20How to Corrupt a SQLite Database FileBest threadpcr910303372148
2020-06-24How to Corrupt an SQLite Databasethstall10
2022-04-30How to Corrupt an SQLite Database FileHall induction · Latest 20+ point returnsegfaultbuserr225139
2022-11-07How to Corrupt an SQLite Database Filetempodox31
2024-08-31How to Corrupt an SQLite Database Filetosh10
2024-10-28How to Corrupt an SQLite Database Fileeadmund20
2026-04-21How to Corrupt an SQLite Database Filethunderbong30