Skip to content

Conversation

@deitch
Copy link
Collaborator

@deitch deitch commented Jul 20, 2025

- What I did
We already lock the index before writing to it. However, the write is not atomic; the underlying ggcr library writes it in place. That means that some other thread or process reading it can get a corrupt file if it is mid-write. It would be nice if we could make the writes atomic, but ggcr does not support it.

Instead, we use the same lock everywhere that we read the cache root index. That turns out to be only in three places, so I added a function cache.Provider.Index() which gets the root index, and that uses the lock.

- How I did it
As described above.

- How to verify it
CI

- Description for the changelog

lock when reading cache root index.

@deitch deitch merged commit eae7887 into linuxkit:master Jul 21, 2025
22 checks passed
@deitch deitch deleted the lock-cache-index-read branch July 21, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant