Skip to content

Do not read entire file in memory for hash calculation#122

Merged
geofffranks merged 2 commits intocloudfoundry:mainfrom
sap-contributions:optimise-uploader-hash-calc
Jun 19, 2025
Merged

Do not read entire file in memory for hash calculation#122
geofffranks merged 2 commits intocloudfoundry:mainfrom
sap-contributions:optimise-uploader-hash-calc

Conversation

@pbusko
Copy link
Copy Markdown
Contributor

@pbusko pbusko commented Jun 11, 2025

Summary

Currently the uploader reads entire file in memory just for MD5 and SHA256 sums calculation. If a buildpack cache archive or droplets are large, it might affect the entire cell.

With the new approach the file is read with the default chunk sizes of 32K, not storing the actual content.

Backward Compatibility

Breaking Change? No

Co-authored-by: Jan von Loewenstein <jan.von.loewenstein@sap.com>
@pbusko pbusko requested a review from PlamenDoychev June 16, 2025 06:20
@PlamenDoychev
Copy link
Copy Markdown
Contributor

Hi @pbusko ,

Can you also create one issue here: https://github.com/cloudfoundry/diego-release/issues and provide details and motivation for the proposal and link this PR to it. Just look at the various issues we have open and follow the "template".

@github-project-automation github-project-automation bot moved this from Inbox to Pending Merge | Prioritized in Application Runtime Platform Working Group Jun 18, 2025
@geofffranks
Copy link
Copy Markdown
Contributor

LGTM. I wanted to double check that gosec wasn't going to freak out at io.Copy vs io.CopyN and decompression bomb issues, but it seems smart enough to know this isn't decompressing data.

@geofffranks geofffranks merged commit 3192fb1 into cloudfoundry:main Jun 19, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from Pending Merge | Prioritized to Done in Application Runtime Platform Working Group Jun 19, 2025
@pbusko pbusko deleted the optimise-uploader-hash-calc branch June 20, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants