ssh: disable concurrent transfers if no multiplexing#5136
Merged
bk2204 merged 2 commits intogit-lfs:mainfrom Oct 17, 2022
Merged
ssh: disable concurrent transfers if no multiplexing#5136bk2204 merged 2 commits intogit-lfs:mainfrom
bk2204 merged 2 commits intogit-lfs:mainfrom
Conversation
chrisd8088
reviewed
Oct 5, 2022
Member
chrisd8088
left a comment
There was a problem hiding this comment.
I only had a few notes, and I notice the Windows CI jobs seems to be failing, so maybe that's something worth review as well (but perhaps it's not related to this PR)?
In our SSH code, we check if the error is non-nil and then enable multiplexing. However, this is backwards: only if the error is nil do we have a valid path and can we enable multiplexing. Fix this condition properly. Since our tests will now often get additional arguments, update lfs-ssh-echo to handle them gracefully.
Right now, we try to spawn multiple SSH connections using ControlMaster when making multiple requests. However, if multiplexing is not enabled, we can spawn multiple actual connections, which can be expensive and require lots of authentication requests. Instead, let's make sure we don't enable multiple connections if multiplexing is not enabled, since this may cause the user to be prompted for multiple SSH key connection attempts (say, if they're using a security key) and is substantially more heavyweight than simply spawning a new process over the same connection. Since the code has different behaviour if `XDG_RUNTIME_DIR` is set, make sure to unset it for the tests so that we always try to create a temporary directory and don't otherwise fail because that environment variable points somewhere unexpected.
Member
Author
|
Okay, the test failure has magically disappeared, I've added tests (and some additional commits since I discovered a bug), and this should be ready for another review when that's convenient. |
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Oct 22, 2024
In commit b44cbe4 of PR git-lfs#5136 the "multiplex" argument was added to the FormatArgs() function in our ssh/ssh.go source file. Later, the "controlPath" argument was also added, in commit 448b0c4 of PR git-lfs#5537. Neither of these arguments is used in the function's body, though, so we can remove them now.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Oct 23, 2024
In commit b44cbe4 of PR git-lfs#5136 the "multiplex" argument was added to the FormatArgs() function in our ssh/ssh.go source file. Later, the "controlPath" argument was also added, in commit 448b0c4 of PR git-lfs#5537. Neither of these arguments is used in the function's body, though, so we can remove them now.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Oct 29, 2024
In commit b44cbe4 of PR git-lfs#5136 the "multiplex" argument was added to the FormatArgs() function in our ssh/ssh.go source file. Later, the "controlPath" argument was also added, in commit 448b0c4 of PR git-lfs#5537. Neither of these arguments is used in the function's body, though, so we can remove them now.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Nov 1, 2024
In commit b44cbe4 of PR git-lfs#5136 the "multiplex" argument was added to the FormatArgs() function in our ssh/ssh.go source file. Later, the "controlPath" argument was also added, in commit 448b0c4 of PR git-lfs#5537. Neither of these arguments is used in the function's body, though, so we can remove them now.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Nov 3, 2024
In commit b44cbe4 of PR git-lfs#5136 the "multiplex" argument was added to the FormatArgs() function in our ssh/ssh.go source file. Later, the "controlPath" argument was also added, in commit 448b0c4 of PR git-lfs#5537. Neither of these arguments is used in the function's body, though, so we can remove them now.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Nov 4, 2024
In commit b44cbe4 of PR git-lfs#5136 the "multiplex" argument was added to the FormatArgs() function in our ssh/ssh.go source file. Later, the "controlPath" argument was also added, in commit 448b0c4 of PR git-lfs#5537. Neither of these arguments is used in the function's body, though, so we can remove them now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Right now, we try to spawn multiple SSH connections using ControlMaster when making multiple requests. However, if multiplexing is not enabled, we can spawn multiple actual connections, which can be expensive and require lots of authentication requests.
Instead, let's make sure we don't enable multiple connections if multiplexing is not enabled, since this may cause the user to be prompted for multiple SSH key connection attempts (say, if they're using a security key) and is substantially more heavyweight than simply spawning a new process over the same connection.
Fixes #5064