Merge pull request #84484 from zxl381/GL_framework

Prevent 2 goroutines in test from being leaked if proxy hangs
This commit is contained in:
Kubernetes Prow Robot 2019-10-29 05:52:56 -07:00 committed by GitHub
commit 3f8b0a30ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -89,10 +89,9 @@ type RuntimeOperationErrorRate struct {
// ProxyRequest performs a get on a node proxy endpoint given the nodename and rest client.
func ProxyRequest(c clientset.Interface, node, endpoint string, port int) (restclient.Result, error) {
// proxy tends to hang in some cases when Node is not ready. Add an artificial timeout for this call.
// This will leak a goroutine if proxy hangs. #22165
// proxy tends to hang in some cases when Node is not ready. Add an artificial timeout for this call. #22165
var result restclient.Result
finished := make(chan struct{})
finished := make(chan struct{}, 1)
go func() {
result = c.CoreV1().RESTClient().Get().
Resource("nodes").

View File

@ -76,8 +76,7 @@ func parseKubeletMetrics(data string) (KubeletMetrics, error) {
func (g *Grabber) getMetricsFromNode(nodeName string, kubeletPort int) (string, error) {
// There's a problem with timing out during proxy. Wrapping this in a goroutine to prevent deadlock.
// Hanging goroutine will be leaked.
finished := make(chan struct{})
finished := make(chan struct{}, 1)
var err error
var rawOutput []byte
go func() {