[client] Bound the SSH session request queue and keep resizes from blocking the session loop (#8363)

* Bound the SSH session request queue by bytes and stop resizes reaching a loop with no consumer

* Give the window change drain loop a body

* Avoid an empty case clause in the SSH request filter

* Charge only the newest resize to the request queue and classify requests before the byte limit
This commit is contained in:
Viktor Liu
2026-10-26 23:04:32 +09:00
committed by GitHub
parent 280aa188d8
commit 08b924f739
4 changed files with 276 additions and 29 deletions
+8 -1
View File
@@ -53,13 +53,20 @@ func (s *Server) sessionHandler(session ssh.Session) {
logger.Infof("SSH session closed after %v", duration)
}()
ptyReq, winCh, isPty := session.Pty()
if isPty {
// The request loop blocks sending a resize nobody reads, and only sees its request
// stream close once that send completes. Covers the paths below that return
// without consuming window changes.
defer drainWindowChanges(winCh)
}
privilegeResult, err := s.userPrivilegeCheck(session.User())
if err != nil {
s.handlePrivError(logger, session, err)
return
}
ptyReq, winCh, isPty := session.Pty()
hasCommand := session.RawCommand() != ""
if isPty && !hasCommand {