fix(crafter): release go-git packfile descriptors after repository reads - #3345
Merged
Conversation
go-git v6.0.0-alpha.5 gives every PlainOpen* call its own 256-entry descriptor pool holding roughly 3 descriptors per packfile (.pack/.idx/.rev). The pool frees them only on LRU eviction, which never fires below 256 entries, so the descriptors stayed open for the lifetime of the process. alpha.4 released them right after each read. The crafter opens the repository up to twice per attestation init and never closed the storer, so a heavily packed checkout retained around 48 descriptors per open. Release them explicitly through storer.IdleReleaser once the reads are done; they reopen lazily, so the repository stays usable afterwards. Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
matiasinsaurralde
marked this pull request as ready for review
August 12, 2026 23:23
Contributor
Security Checks — ✅ 2 passingPR info
|
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
iac-scan |
no IaC files changed |
Powered by Chainloop and Chainloop Trace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes PFM-6929
Summary
Since the go-git v6 alpha.5 bump (#3336), every
PlainOpen*call builds its own 256-entry descriptor pool holding roughly 3 descriptors per packfile, freed only on LRU eviction — which never fires below 256 entries. alpha.4 released them right after each read.The crafter opens the repository up to twice per
attestation initand never closed the storer, so those descriptors stayed open until the process exited. They are now released throughstorer.IdleReleaseronce the reads complete; descriptors reopen lazily, so the repository remains usable.