Here's how it works, real quick: main: deletes the database main: creates an empty database with one record and closes it thread_a opens the database and sleeps for five seconds thread_b opens the database and gets blocked waiting for a lock thread_a wakes up from the five second sleep thread_a writes a bunch of records to the database thread_a dumps the database to foo02.db.dump01 thread_a gives up the lock and exists thread_b wakes up with the lock thread_b dumps the database to foo02.db.dump02 (you many of the records written by thread_a are not found in this dump) thread_b writes it's own bunch of records thread_b dumps the database to foo02.db.dump03 (this dump has all of the thread_b records and is missing many of the thread_b records) thread_b exits main: opens the database and dumps it to foo02.db.dump04 (which ends up having the same records as foo02.db.dump03 showing that the corruption is in the database file on this disk) These "threads" are just implemented as their own processes in UNIX.