[ARVADOS] updated: 19f4e54627a88c115e299fa328acf22504d1ce66

git at public.curoverse.com git at public.curoverse.com
Thu May 29 09:22:46 EDT 2014


Summary of changes:
 sdk/go/src/arvados.org/keepclient/support.go         | 7 +++++++
 services/keep/src/arvados.org/keepproxy/keepproxy.go | 1 +
 2 files changed, 8 insertions(+)

       via  19f4e54627a88c115e299fa328acf22504d1ce66 (commit)
      from  40b6a69496aa50349d07daa6b28ae36bddd8a6a4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 19f4e54627a88c115e299fa328acf22504d1ce66
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu May 29 09:22:43 2014 -0400

    Go Keep client correctly closes response body on client requests, should fix
    lingering connections problem.  Also added graceful shutdown on SIGINT to
    keepproxy. refs #1885

diff --git a/sdk/go/src/arvados.org/keepclient/support.go b/sdk/go/src/arvados.org/keepclient/support.go
index b1d59f0..5aeec12 100644
--- a/sdk/go/src/arvados.org/keepclient/support.go
+++ b/sdk/go/src/arvados.org/keepclient/support.go
@@ -63,6 +63,10 @@ func (this *KeepClient) DiscoverKeepServers() error {
 		}
 	}
 
+	// 'defer' is a stack, so it will drain the Body before closing it.
+	defer resp.Body.Close()
+	defer io.Copy(ioutil.Discard, resp.Body)
+
 	type svcList struct {
 		Items []keepDisk `json:"items"`
 	}
@@ -198,6 +202,9 @@ func (this KeepClient) uploadToKeepServer(host string, hash string, body io.Read
 		fmt.Sscanf(xr, "%d", &rep)
 	}
 
+	defer resp.Body.Close()
+	defer io.Copy(ioutil.Discard, resp.Body)
+
 	respbody, err2 := ioutil.ReadAll(&io.LimitedReader{resp.Body, 4096})
 	if err2 != nil && err2 != io.EOF {
 		upload_status <- uploadStatus{err2, url, resp.StatusCode, rep, string(respbody)}
diff --git a/services/keep/src/arvados.org/keepproxy/keepproxy.go b/services/keep/src/arvados.org/keepproxy/keepproxy.go
index 414835c..42f5a78 100644
--- a/services/keep/src/arvados.org/keepproxy/keepproxy.go
+++ b/services/keep/src/arvados.org/keepproxy/keepproxy.go
@@ -100,6 +100,7 @@ func main() {
 		listener.Close()
 	}(term)
 	signal.Notify(term, syscall.SIGTERM)
+	signal.Notify(term, syscall.SIGINT)
 
 	if pidfile != "" {
 		f, err := os.Create(pidfile)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list