From a81beea9b4bebbefb723f49a2e63666dd93b8f12 Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Thu, 20 Dec 2018 16:45:42 -0500 Subject: [PATCH] Fixing leaking connections Signed-off-by: Serguei Bezverkhi --- cmd/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 8e18b80c..56c75002 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -68,7 +68,6 @@ func getCSIConnection() (connection.CSIConnection, error) { } func checkHealth(w http.ResponseWriter, req *http.Request) { - glog.Infof("Request: %s from: %s\n", req.URL.Path, req.RemoteAddr) csiConn, err := getCSIConnection() if err != nil { @@ -77,6 +76,7 @@ func checkHealth(w http.ResponseWriter, req *http.Request) { glog.Infof("Failed to get connection to CSI with error: %v.", err) return } + defer csiConn.Close() ctx, cancel := context.WithTimeout(context.Background(), *connectionTimeout) defer cancel() if err := runProbe(ctx, csiConn); err != nil {