Skip to content

Fix: memory leak and silent read error in Archiver._compressFile causing build failures under /Users/#1432

Merged
jglogan merged 1 commit intoapple:mainfrom
Ronitsabhaya75:bug-container-build-fails
Apr 22, 2026
Merged

Fix: memory leak and silent read error in Archiver._compressFile causing build failures under /Users/#1432
jglogan merged 1 commit intoapple:mainfrom
Ronitsabhaya75:bug-container-build-fails

Conversation

@Ronitsabhaya75
Copy link
Copy Markdown
Contributor

@Ronitsabhaya75 Ronitsabhaya75 commented Apr 20, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

fixes : #1423

_compressFile() allocated a 1 MiB read buffer per file but never freed it, leaking ~20 GiB with large contexts (~20k files). It also treated InputStream.read() errors (-1) the same as EOF (0), silently swallowing TCC access denials under /Users/ and corrupting the archive state — which surfaced as the unhelpful "unable to write data to the archive, code 0" error.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@Ronitsabhaya75 Ronitsabhaya75 marked this pull request as ready for review April 20, 2026 02:51
Copy link
Copy Markdown
Contributor

@jglogan jglogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Ronitsabhaya75, good catch!

@jglogan jglogan merged commit 2e029c8 into apple:main Apr 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants