Skip to content

Commit

Permalink
Merge pull request openshift#604 from ricardomaraschini/close-pipe-re…
Browse files Browse the repository at this point in the history
…ader

Bug 1885179: Avoid deadlock by closing pipe reader end
  • Loading branch information
openshift-merge-robot authored Oct 21, 2020
2 parents ef8cad4 + ef98e39 commit 6576713
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/helpers/image/dockerlayer/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ func DigestCopy(dst io.ReaderFrom, src io.Reader) (layerDigest, blobDigest diges
// calculate the diffID as the sha256 sum of the layer contents
pr, pw := io.Pipe()
layerhash := algo.Hash()
ch := make(chan error)
ch := make(chan error, 1)
go func() {
defer close(ch)
gr, err := gzip.NewReader(pr)
if err != nil {
ch <- fmt.Errorf("unable to create gzip reader layer upload: %v", err)
err := fmt.Errorf("unable to create gzip reader layer upload: %v", err)
pr.CloseWithError(err)
ch <- err
return
}
if !gr.Header.ModTime.IsZero() {
Expand Down

0 comments on commit 6576713

Please sign in to comment.