Problem
#44 gave each sync-state writer a uniquely-named temp file (pid + process-local counter) so concurrent saves cannot interleave:
.sync-state.json.tmp.<pid>.<n>
save_sync_state removes the temp file when a save fails, but a process that is killed between the write and the rename leaves one behind. Because the names are unique, these accumulate rather than being overwritten — one file per crash, forever, in the database directory.
Low severity (small files, no correctness impact) but it is an unbounded leak, and the shared-name version it replaced did not have it.
Proposal
On startup or before saving, sweep .sync-state.json.tmp.* in the state directory and remove entries whose owning pid is no longer alive (or that are older than some threshold). Cheap: the directory holds a handful of files.
Related: #44
Problem
#44 gave each sync-state writer a uniquely-named temp file (
pid+ process-local counter) so concurrent saves cannot interleave:save_sync_stateremoves the temp file when a save fails, but a process that is killed between the write and the rename leaves one behind. Because the names are unique, these accumulate rather than being overwritten — one file per crash, forever, in the database directory.Low severity (small files, no correctness impact) but it is an unbounded leak, and the shared-name version it replaced did not have it.
Proposal
On startup or before saving, sweep
.sync-state.json.tmp.*in the state directory and remove entries whose owning pid is no longer alive (or that are older than some threshold). Cheap: the directory holds a handful of files.Related: #44