-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error handling for pure SSH protocol #5063
Merged
Merged
Conversation
This file contains 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
In some cases, we can end up with a panic due to a pure SSH transfer lacking any connections, but it's not clear what those cases are. Let's help improve a possible failure case by explicitly setting sshTransfer to nil, since shutting down is the only case in which we explicitly set the number of connections to 0. This means that we'll get a better error message in such a case, since we'll attempt a legacy SSH connection, which won't work, and that will be reported to the user.
In some cases, we can end up with a panic due to a pure SSH transfer lacking any connections, but it's not clear what those cases are. Let's add some explicit checks that our connection is functional and return an error if not.
Let's improve the logging for the pure SSH protocol so that when we have a problem, it's easier for users to use the trace output to figure out what's wrong.
bk2204
force-pushed
the
pure-ssh-failure
branch
from
February 15, 2023 21:50
d5a6456
to
326b1ee
Compare
chrisd8088
approved these changes
Feb 16, 2023
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Oct 22, 2024
We added trace logging to several functions and methods related to the creation and shutdown of SSH connections in commit 326b1ee of PR git-lfs#5063, which help when debugging any problems with our implementation of the SSH-based object transfer protocol. However, in the startConnection() function in our ssh/connection.go source file, we report the successful creation of a connection even if we are returning a non-nil error value. Therefore we revise our trace logging there to distinguish unsuccessful and successful conditions, based on whether the PktlineConnection structure's Start() method returned an error or not. As well, we update a number of our other trace log message to include the connection ID. Because we maintain a set of SSH connections and do not necessarily start or shut down all of them at the same time, this change provides further clarity as to the state of each individual connection at different points in a trace log.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Oct 23, 2024
We added trace logging to several functions and methods related to the creation and shutdown of SSH connections in commit 326b1ee of PR git-lfs#5063, which help when debugging any problems with our implementation of the SSH-based object transfer protocol. However, in the startConnection() function in our ssh/connection.go source file, we report the successful creation of a connection even if we are returning a non-nil error value. Therefore we revise our trace logging there to distinguish unsuccessful and successful conditions, based on whether the PktlineConnection structure's Start() method returned an error or not. As well, we update a number of our other trace log message to include the connection ID. Because we maintain a set of SSH connections and do not necessarily start or shut down all of them at the same time, this change provides further clarity as to the state of each individual connection at different points in a trace log.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Oct 29, 2024
We added trace logging to several functions and methods related to the creation and shutdown of SSH connections in commit 326b1ee of PR git-lfs#5063, which help when debugging any problems with our implementation of the SSH-based object transfer protocol. However, in the startConnection() function in our ssh/connection.go source file, we report the successful creation of a connection even if we are returning a non-nil error value. Therefore we revise our trace logging there to distinguish unsuccessful and successful conditions, based on whether the PktlineConnection structure's Start() method returned an error or not. As well, we update a number of our other trace log message to include the connection ID. Because we maintain a set of SSH connections and do not necessarily start or shut down all of them at the same time, this change provides further clarity as to the state of each individual connection at different points in a trace log.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Nov 1, 2024
We added trace logging to several functions and methods related to the creation and shutdown of SSH connections in commit 326b1ee of PR git-lfs#5063, which help when debugging any problems with our implementation of the SSH-based object transfer protocol. However, in the startConnection() function in our ssh/connection.go source file, we report the successful creation of a connection even if we are returning a non-nil error value. Therefore we revise our trace logging there to distinguish unsuccessful and successful conditions, based on whether the PktlineConnection structure's Start() method returned an error or not. As well, we update a number of our other trace log message to include the connection ID. Because we maintain a set of SSH connections and do not necessarily start or shut down all of them at the same time, this change provides further clarity as to the state of each individual connection at different points in a trace log.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Nov 3, 2024
We added trace logging to several functions and methods related to the creation and shutdown of SSH connections in commit 326b1ee of PR git-lfs#5063, which help when debugging any problems with our implementation of the SSH-based object transfer protocol. However, in the startConnection() function in our ssh/connection.go source file, we report the successful creation of a connection even if we are returning a non-nil error value. Therefore we revise our trace logging there to distinguish unsuccessful and successful conditions, based on whether the PktlineConnection structure's Start() method returned an error or not. As well, we update a number of our other trace log message to include the connection ID. Because we maintain a set of SSH connections and do not necessarily start or shut down all of them at the same time, this change provides further clarity as to the state of each individual connection at different points in a trace log.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Nov 4, 2024
In commit 326b1ee of PR git-lfs#5063 we added trace logging to several functions and methods related to the creation and termination of SSH sessions in order to help analyze the diagnostic logs generated when transferring Git LFS objects over SSH. However, in the startConnection() function in our ssh/connection.go source file, we report the successful creation of a session even if we are returning a non-nil error value. Therefore we revise our trace logging in that function to distinguish between unsuccessful and successful conditions based on whether the PktlineConnection structure's Start() method returned an error or not. In addition, we also update a number of our other trace log messages to include the relevant session ID. (Note that we refer to SSH sessions as "connections" in our code, although in practice they may share a single SSH connection using a control socket.) Because we maintain a set of SSH sessions and do not necessarily start or terminate all of them at the same time, this change will provide more clarity as to the state of each individual session at different points in a trace log. Finally, we rephrase several trace log messages generated by the setConnectionCount() method of the SSHTransfer structure so they more fully explain when the method is terminating specific sessions because it has been asked to reduce the total number of sessions.
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.
In some cases, we can end up with a panic due to a pure SSH transfer lacking any connections, but it's not clear what those cases are. Let's add some explicit checks that our connection is functional and return an error if not, and let's also add some defensiveness to make sure that if we encounter an unexpected case that we return a better error message.