mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #84484 from zxl381/GL_framework
Prevent 2 goroutines in test from being leaked if proxy hangs
This commit is contained in:
commit
3f8b0a30ad
@ -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").
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user