Port Conflict Detection and SSH Forwarding Improvements #5
+12
−2
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.
🔄 Changes
This PR enhances the
rdp-sshscript to handle port conflicts more gracefully:ExitOnForwardFailure=noto prevent SSH connection hangs when port forwarding conflicts occurNone
🎯 Motivation
Problem 1: Docker Port Allocation Conflicts
Details
When starting a new virtual desktop session,
rdp-sshonly checked X11 display numbers in/tmp/.X11-unix/but didn't verify if the corresponding Docker port was actually available. This caused "port already allocated" errors when:Example Error (from #4):
Problem 2: SSH Port Forwarding Conflicts
Details
Multiple connections to the same remote host caused SSH port forwarding conflicts, especially with
~/.ssh/configLocalForwardsettings (e.g.,LocalForward 5900 localhost:5900for VNC).Symptom:
This resulted in several-minute connection times when opening multiple terminal sessions.
🔍 Reproduction Steps
Test 1: Port Conflict Detection (Verified on robot_dev7)
Details
Result: Successfully detected port conflict and skipped to next available port (6093) in ~2.5 seconds.
Test 2: SSH Forwarding Graceful Failure (Verified on robot_dev7)
Details
Result: With
ExitOnForwardFailure=no, connection succeeds immediately (~3 seconds) despite port forwarding error messages.✅ Results
Performance Improvement:
📝 Additional Notes
startandconnectcommands now useExitOnForwardFailure=nofor consistent behavior