Skip to content

Commit a781c95

Browse files
committed
fix(ssh-for-commander): fix gossh goroutine leaks
Signed-off-by: Ilya Mayorov <ilya.mayorov@flant.com>
1 parent fd26849 commit a781c95

9 files changed

Lines changed: 733 additions & 94 deletions

File tree

pkg/ssh/base/kubeproxy/kube_proxy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import (
3030
"github.com/deckhouse/lib-connection/pkg/ssh/session"
3131
)
3232

33+
var kubeProxyPortReadyTimeout = 20 * time.Second
34+
3335
type StartCommandParams struct {
3436
OnStart func()
3537
StdoutHandler func(string)
@@ -448,17 +450,19 @@ Status: %w`
448450
}
449451

450452
// Wait for proxy startup
451-
t := time.NewTicker(20 * time.Second)
453+
t := time.NewTicker(kubeProxyPortReadyTimeout)
452454
defer t.Stop()
453455
select {
454456
case e := <-waitCh:
455457
return nil, "", returnWaitErr(e)
456458
case <-t.C:
457459
k.debugWithID(startID, "Starting proxy command timeout")
460+
proxy.Stop()
458461
return nil, "", fmt.Errorf("timeout waiting for api proxy port")
459462
case <-portReady:
460463
if port == "" {
461464
k.debugWithID(startID, "Starting proxy command: empty port")
465+
proxy.Stop()
462466
return nil, "", fmt.Errorf("got empty port from kubectl proxy")
463467
}
464468
}

0 commit comments

Comments
 (0)