Skip to content

Git cache leaks .tmp files (~400k orphans observed on Windows) #563

Description

@niklasgs

writePersistentCache in src/utils/git.ts writes the git cache as git-<hash>.json.<pid>.<timestamp>.tmp, then renames it over the cache file inside a catch that swallows all errors — the temp file is never deleted when the rename fails.

On Windows the rename fails frequently with EPERM (a virus scanner or sync client holding a handle on the fresh temp file), so every git-widget cache write leaks one uniquely named file. Observed on one machine: 397,647 orphaned .tmp files (~215 MB) in ~/.cache/ccstatusline/git-cache/. Nothing ever cleans them up. On macOS/Linux orphans only appear if the process dies mid-write.

Workaround: delete ~/.cache/ccstatusline/git-cache/ — it regenerates itself.

Fix incoming in a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions