Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary files are not deleted after build #1167

Open
matejvasek opened this issue May 7, 2021 · 4 comments
Open

Temporary files are not deleted after build #1167

matejvasek opened this issue May 7, 2021 · 4 comments
Labels
good first issue A good first issue to get started with. status/ready Issue ready to be worked on. type/bug Issue that reports an unexpected behaviour.

Comments

@matejvasek
Copy link
Contributor

matejvasek commented May 7, 2021

Summary

Temporary files are not deleted (nor reused) after build when using with podman.

The podman doesn't support "sparse" tarballs, so pack has to download builder layers to temp.
The issue is that the files are not deleted after build finished.

Even more so when pack build is run repeatedly multiple identical temporary directories occupy temp filesystem.
This is particularly problematic when /tmp is in RAM.

I think pack should one of the following:

  • delete the temp directory right after build
  • do not delete the directory after build and reuse it for subsequent builds
@matejvasek matejvasek added status/triage Issue or PR that requires contributor attention. type/bug Issue that reports an unexpected behaviour. labels May 7, 2021
@matejvasek
Copy link
Contributor Author

Seems reusing might be against https://refspecs.linuxfoundation.org/FHS_2.3/fhs-2.3.html#TMPTEMPORARYFILES
Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.

@dwillist dwillist added the status/discussion-needed Issue or PR that requires in-depth discussion. label May 19, 2021
@dwillist
Copy link
Contributor

dwillist commented Jun 2, 2021

Comments from Platform Sync.
Needs some investigation around what layers are not getting cleaned up here.

  • Are these from the ephemeral builder?
  • Are these a lifecycle concern?
    Some additional investigation is needed to figure out which layers are being left around.

@jromero jromero added status/ready Issue ready to be worked on. and removed status/discussion-needed Issue or PR that requires in-depth discussion. status/triage Issue or PR that requires contributor attention. labels Jun 16, 2021
@matejvasek
Copy link
Contributor Author

@dwillist I think this is related to ephemeral builder. The thing is that pack uses clever hack to speed up build. It pushes only newly create layers (they are small) for ephemeral builder and it leaves out some rather large layers that are already present in daemon.

While such an archive missing layer is not 100% valid docker happily accepts it provided the missing layers are already in it. This is not the case for podman which is less permissive (podman is alternative docker implementation).

Some changes had to be done to fix it #925, buildpacks/imgutil#81.

podman works now, however the fix leads to accumulation of temp files.

@natalieparellano natalieparellano added good first issue A good first issue to get started with. help wanted Need some extra hands to get this done. and removed help wanted Need some extra hands to get this done. labels Aug 21, 2023
@jjbustamante
Copy link
Member

@matejvasek

Could you test this with the latest pack version? I tried to reproduce it today and after building a sample java app, I checked my tmp folder and I didn't see anything there. I am running pack on a arm64 machine using podman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A good first issue to get started with. status/ready Issue ready to be worked on. type/bug Issue that reports an unexpected behaviour.
Projects
None yet
Development

No branches or pull requests

5 participants