A Syncthing and SQLite Gotcha

ibobev 18 points 6 comments August 24, 2026
borretti.me · View on Hacker News

Discussion Highlights (3 comments)

euroderf

Shouldn't this return errors to the "other processes [that] had open file descriptors pointing to new" ?

zbentley

I think there is an important typo: > what happens if other processes had open file descriptors pointing to new Should end with “old”, not “new”.

zbentley

Yes, handle statefulness is very important. A cheap way to detect and handle this condition in your application code is to call fstat on the open file handle and check the number of references. If that number drops to zero, you have an orphan. Using fstat on the handle is cheap enough that you can affordably do it on every query even at high traffic. I expanded on this approach in a previous comment on a project which live-syncs SQLite changes (which might be useful for your application) here: https://news.ycombinator.com/item?id=47884461

Semantic search powered by Rivestack pgvector
4,281 stories · 38,573 chunks indexed