Skip to content
← Bookmarks
Added 4 Aug 2026danluu.comfiled under Products That Last

Writing a file to disk is not the safe operation you think

A note on Files are hard by Dan Luu, published on danluu.com.

On the surface this is about filesystems, which is not most people's problem. Read it for the pattern instead, because the pattern is everywhere.

The recurring failure is the same one: code that is correct under normal operation and wrong under interruption. Everything works in development, everything works in the test suite, and the bug only exists in the gap between two operations that were assumed to be one. Nobody ever sees it until the machine dies at the wrong moment or a request is retried mid-flight.

That is the same shape as a payment captured before the licence is issued, or a subscription updated in your database before the provider confirms it. Different layer, identical structure, a sequence assumed to be atomic that is not.

The other thing worth taking is the epistemics. The piece is built on studies rather than on experience, and it repeatedly finds that widely held assumptions were wrong across many real systems. That is a good reminder for anyone who has ever concluded a rare bug was a fluke because it did not reproduce.

This is the thinking behind storing money as integer cents rather than a float.

Read the original ↗ reliability · databases · durability
also read
let's talk

Building something where this kind of work matters?

I'm in GMT+6 and work async-first, so your timezone is never a reason not to reach out.

Get in touch
Copyright © Hasan Misbah. All rights reserved.Privacy
Hasan Misbah