Skip to content

fix: increase SSH connection timeout from 5s to 15s for child nodes#12274

Open
jakub961241 wants to merge 1 commit into1Panel-dev:dev-v2from
jakub961241:fix/ssh-timeout-increase-11621
Open

fix: increase SSH connection timeout from 5s to 15s for child nodes#12274
jakub961241 wants to merge 1 commit into1Panel-dev:dev-v2from
jakub961241:fix/ssh-timeout-increase-11621

Conversation

@jakub961241
Copy link

Summary

Fixes #11621 - Child node SSH connection fails with "ssh: handshake failed: i/o timeout" when network latency is high (e.g., domestic China to overseas servers).

Root Cause

Default DialTimeOut was hardcoded to 5 seconds at core/utils/ssh/ssh.go:51 and agent/utils/ssh/ssh.go:43. For cross-border connections with several seconds of latency, this wasn't enough for both TCP dial + SSH handshake.

Additionally, DialWithTimeout set the handshake deadline equal to the dial timeout (conn.SetDeadline(time.Now().Add(config.Timeout))), which meant the SSH handshake had to complete in the same window as the dial.

Fix

  • Increase default DialTimeOut from 5s to 15s (both core and agent)
  • Set handshake deadline to 2x the timeout (config.Timeout * 2) to give more time for the SSH key exchange after TCP connection

Changed files

  • core/utils/ssh/ssh.go - Default timeout 5s → 15s, handshake deadline × 2
  • agent/utils/ssh/ssh.go - Default timeout 5s → 15s
fix: Increase SSH connection timeout from 5s to 15s for better child node connectivity (#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 1Panel-dev#11621
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Mar 22, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zhengkunwang223 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] The sub-node cannot be connected

1 participant