mirror of https://github.com/k3s-io/k3s
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
commit
c6fec87021
|
@ -362,8 +362,12 @@ 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) {
|
||||||
|
|
Loading…
Reference in New Issue