Skip to content

Reconnect gateway replica SSH tunnels after process exit - #4355

Merged
peterschmidt85 merged 3 commits into
masterfrom
issue_4352_supervise_replica_tunnels
Oct 8, 2026
Merged

peterschmidt85 merged 3 commits into
masterfrom
issue_4352_supervise_replica_tunnels

Conversation

@peterschmidt85

Copy link
Copy Markdown
Contributor

Fixes #4352.

When a replica's SSH process exits, nginx keeps forwarding to its abandoned Unix socket and returns HTTP 502 indefinitely.

  • Supervise gateway SSH processes and reconnect on exit, reusing the same socket so nginx needs no reconfiguration.
  • Retry failed reconnections with backoff and at most eight simultaneous attempts to avoid overloading the gateway during a shared outage.
  • Clean up SSH and ProxyCommand processes during failed startup, replica removal, and cancellation.
  • Use uvloop on gateways to avoid allocating one waiting thread per replica on Python 3.10.

Existing gateways receive the fix automatically when the server is updated to the fixed release under default settings.

@peterschmidt85
peterschmidt85 merged commit a32aba8 into master Oct 8, 2026
26 checks passed
@peterschmidt85
peterschmidt85 deleted the issue_4352_supervise_replica_tunnels branch October 8, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gateway keeps returning 502 after a replica SSH tunnel exits

1 participant