From 8079a6940cb2418314ccb6b87ee659faedfb8d54 Mon Sep 17 00:00:00 2001 From: James Tucker <raggi@google.com> Date: Mon, 22 Apr 2019 21:12:57 +0000 Subject: [PATCH] [amber] fix resource exhaustion during pkg install The code was not correctly handling the closing of the request body, or exiting the retry loop, leading to resource exhaustion for very large package installations. Bug: PKG-696 #done Change-Id: I0ea321f40d9d0fd4e42581096efe65371db2a95a --- garnet/go/src/amber/source/source.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/garnet/go/src/amber/source/source.go b/garnet/go/src/amber/source/source.go index e33bacb683c..83d95583036 100644 --- a/garnet/go/src/amber/source/source.go +++ b/garnet/go/src/amber/source/source.go @@ -705,6 +705,7 @@ func (f *Source) FetchInto(blob string, length int64, outputDir string) error { Temporary() bool Timeout() bool }); ok && e.Temporary() && e.Timeout() { + log.Printf("timed out fetching %s", blob) f.closeIdleConnections() continue } @@ -712,6 +713,7 @@ func (f *Source) FetchInto(blob string, length int64, outputDir string) error { if err != nil { return err } + break } defer resp.Body.Close() -- GitLab