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

Clean up Go tmp directories #4346

Closed
wants to merge 2 commits into from
Closed

Conversation

Nishnha
Copy link
Member

@Nishnha Nishnha commented Oct 26, 2021

Go_modules creates a few temporary directories as part of the FileUpdater process. Unfortunately, we do not clean up these temporary directories up after using them, which can lead to the issue of running out of disk space. This branch was a failed attempt at cleaning up the temporary directories.

There are two spots that we create temporary directories during a go_modules update:

Attempting to remove the temporary directories immediately after either of these steps will cause failures further down the line because when we finish updating the Go files, the update_dependency_files function utilizes the vendor_updater in common which cds into each temporary directory

vendor_updater.updated_vendor_cache_files(base_directory: directory).
each do |file|
updated_files << file
end

Unfortunately, as d6fd635 indicates, attempting to remove the temporary directories (even with force=true) at the end of the update_dependency_files function still fails to actually remove the directories, indicating there may be an open handle preventing the folders from being removed.

I have not tried overriding the vendor_updater class for go_modules, but that could help in resolving when the temporary directories are no longer needed.

Another approach that's being tried to save on disk space during a go_modules updates is using a cache between all modules, instead of using in_repo_path and redownloading modules multiple times.

…pdate tests

Failed attempt to remove temporary directories with `force=true`.
There may be an open handle on the file that's preventing the directory from being removed.
The directories can't be removed any earlier than here since `vendor_updater` in `common` `cd`s into the directory and will throw errors if the dirs are removed.
@Nishnha Nishnha closed this Apr 7, 2022
@jeffwidman jeffwidman deleted the nishnha/go-cleanup-tmp-dirs branch August 8, 2022 18:26
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