From 29e5d86cd78e77f40dc126504fffffd815ca41f8 Mon Sep 17 00:00:00 2001 From: jakub961241 <144362244+jakub961241@users.noreply.github.com> Date: Sun, 22 Mar 2026 01:29:00 +0100 Subject: [PATCH] fix: increase SSH connection timeout from 5s to 15s (#11621) When connecting to child nodes with poor network connectivity (e.g., domestic to international servers), the 5-second SSH timeout was too short, causing "ssh: handshake failed: i/o timeout" errors. Changes: - Increase default DialTimeOut from 5s to 15s (both core and agent) - Double the handshake deadline (config.Timeout * 2) to allow more time for the SSH handshake after TCP connection is established Fixes #11621 --- agent/utils/ssh/ssh.go | 2 +- core/utils/ssh/ssh.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/agent/utils/ssh/ssh.go b/agent/utils/ssh/ssh.go index d00f700e4896..d6a82b12bb46 100644 --- a/agent/utils/ssh/ssh.go +++ b/agent/utils/ssh/ssh.go @@ -40,7 +40,7 @@ func NewClient(c ConnInfo) (*SSHClient, error) { config.Auth = []gossh.AuthMethod{gossh.PublicKeys(signer)} } if c.DialTimeOut == 0 { - c.DialTimeOut = 5 * time.Second + c.DialTimeOut = 15 * time.Second } config.Timeout = c.DialTimeOut diff --git a/core/utils/ssh/ssh.go b/core/utils/ssh/ssh.go index 197b974f3c3d..2e4d809036f9 100644 --- a/core/utils/ssh/ssh.go +++ b/core/utils/ssh/ssh.go @@ -48,7 +48,7 @@ func NewClient(c ConnInfo) (*SSHClient, error) { config.Auth = []gossh.AuthMethod{gossh.PublicKeys(signer)} } if c.DialTimeOut == 0 { - c.DialTimeOut = 5 * time.Second + c.DialTimeOut = 15 * time.Second } config.Timeout = c.DialTimeOut @@ -256,7 +256,7 @@ func DialWithTimeout(network, addr string, useProxy bool, config *gossh.ClientCo if err != nil { return nil, err } - _ = conn.SetDeadline(time.Now().Add(config.Timeout)) + _ = conn.SetDeadline(time.Now().Add(config.Timeout * 2)) c, chans, reqs, err := gossh.NewClientConn(conn, addr, config) if err != nil { return nil, err