fix(ssh-for-commander): fix clissh goroutine leaks#36
Draft
faroyam wants to merge 2 commits into
Draft
Conversation
5bdc727 to
4b6228e
Compare
Signed-off-by: Ilya Mayorov <ilya.mayorov@flant.com>
a1ea139 to
a781c95
Compare
Signed-off-by: Ilya Mayorov <ilya.mayorov@flant.com>
a781c95 to
7212f0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clissh
pkg/ssh/clissh/process/executor.goStop, timeout, and normal exit.Stopidempotent usingsync.Onceand atomics.readFromStreamsexits onos.ErrClosedinstead of looping.pkg/ssh/clissh/tunnel.goTunnel.Stop()now closes pipes and kills the process even whenHealthMonitorwas not started.HealthMonitorexits when the tunnel has already been stopped.gossh
pkg/ssh/gossh/client.goStart,Stop, and keepaliverestart.Stop()now marks the client as stopped before cleanup, so new sessions fail fast after stop.Start()now closes the previous SSH client, sessions, keepalive goroutine, connections, local kube-proxies, and SSH agent socket connection before reconnecting.stopChanddoneCh;stopKeepAlive()waits for shutdown with a timeout instead of blocking forever.restart()no longer resurrects a stopped client and ignores stale restarts from an old keepalive run.kubeProxiesaccess is synchronized and reset during reconnect/stop.allowStoppedpath.pkg/ssh/gossh/keepalive.gostopCh.sshSessionsListdirectly.pkg/ssh/gossh/command.gonewSSHCommand(..., allowStopped)helper.pkg/ssh/gossh/tunnel.goTunnelnow gets the SSH client through a safe snapshot.Stop()no longer causes a nil pointer panic while dialing a remote tunnel endpoint.pkg/ssh/gossh/reverse-tunnel.goReverseTunnelnow gets the SSH client through a safe snapshot.Stop()now returns a normal error instead of panicking onGetClient().Listen(...).pkg/ssh/base/kubeproxy/kube_proxy.go