Merge pull request #24487 from cjcullen/sshleak

Automatic merge from submit-queue

Fix goroutine leak in ssh-tunnel healthcheck.

Tunnel healthchecks were not closing the HTTP response body, leading to many open goroutines.
pull/6/head
k8s-merge-robot 2016-04-19 13:51:15 -07:00
commit c6fec87021
1 changed files with 6 additions and 2 deletions

View File

@ -362,9 +362,13 @@ func (l *SSHTunnelList) healthCheck(e sshTunnelEntry) error {
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}) })
client := &http.Client{Transport: transport} client := &http.Client{Transport: transport}
_, err := client.Get(l.healthCheckURL.String()) resp, err := client.Get(l.healthCheckURL.String())
if err != nil {
return err return err
} }
resp.Body.Close()
return nil
}
func (l *SSHTunnelList) removeAndReAdd(e sshTunnelEntry) { func (l *SSHTunnelList) removeAndReAdd(e sshTunnelEntry) {
// Find the entry to replace. // Find the entry to replace.