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

fixed a goroutine leak #1705

Merged
merged 1 commit into from
May 19, 2023
Merged

Conversation

ktarplee
Copy link
Contributor

If the rc is not closed (which happens when the files with the same digest already exists, due to the same image being added to the OCI layout directory twice) then

if s, err := os.Stat(file); err == nil && !s.IsDir() && (s.Size() == size || size == -1) {
	return nil
}

will not close the io.ReadCloser leaking a goroutine here

@codecov-commenter
Copy link

Codecov Report

Merging #1705 (009eea0) into main (a927d7c) will increase coverage by 0.10%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##             main    #1705      +/-   ##
==========================================
+ Coverage   72.09%   72.20%   +0.10%     
==========================================
  Files         121      121              
  Lines        9733     9720      -13     
==========================================
+ Hits         7017     7018       +1     
+ Misses       2039     2028      -11     
+ Partials      677      674       -3     
Impacted Files Coverage Δ
pkg/crane/get.go 92.59% <0.00%> (-7.41%) ⬇️
pkg/v1/remote/fetcher.go 74.50% <ø> (+1.78%) ⬆️
pkg/v1/remote/puller.go 72.30% <ø> (+2.80%) ⬆️
pkg/v1/layout/write.go 48.26% <100.00%> (+0.18%) ⬆️

... and 1 file with indirect coverage changes

@ktarplee
Copy link
Contributor Author

Closes #1706

Copy link
Collaborator

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

Nice!

@imjasonh imjasonh merged commit 2015ceb into google:main May 19, 2023
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.

3 participants