Skip to content
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

Shell.executeSsh error handling doesn't handle multiple connection failures #2327

Open
awharn opened this issue Oct 29, 2024 · 2 comments
Open
Labels
bug Something isn't working priority-medium Not functioning - next quarter if capacity permits severity-low Bug that makes the usage of the Zowe less convenient but doesn't impact key use cases

Comments

@awharn
Copy link
Member

awharn commented Oct 29, 2024

Describe the bug

If a hostname is resolveable by multiple IP addresses, Shell will attempt to go through each one. If it fails to resolve any of the addresses, and there is more then one address that was tried, it will return with a list of errors (via AggregateError), not a single error.

Our error handling assumes that a single error was thrown. However, in this case, err.message is undefined because err is an AggregateError which contains a list of errors, not a single error. We then throw an unexpected error, and since err.message is undefined on AggregateError, no useful output is given to the user.

Error handling should be updated to check if there is an errors list on err and, if so, concatenate and display the error messages together.

@awharn awharn added bug Something isn't working new The issue wasn't triaged yet labels Oct 29, 2024
Copy link

Thank you for creating a bug report.
We will investigate the bug and evaluate its impact on the product.
If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

@awharn
Copy link
Member Author

awharn commented Oct 29, 2024

From system tests, using localhost as an example:

AggregateError: 
        at internalConnectMultiple (node:net:1117:18)
        at afterConnectMultiple (node:net:1684:7) {
      code: 'ECONNREFUSED',
      level: 'client-socket',
      [errors]: [
        Error: connect ECONNREFUSED 127.0.0.1:22
            at createConnectionError (node:net:1647:14)
            at afterConnectMultiple (node:net:1677:16) {
          errno: -61,
          code: 'ECONNREFUSED',
          syscall: 'connect',
          address: '127.0.0.1',
          port: 22
        },
        Error: connect ECONNREFUSED ::1:22
            at createConnectionError (node:net:1647:14)
            at afterConnectMultiple (node:net:1677:16) {
          errno: -61,
          code: 'ECONNREFUSED',
          syscall: 'connect',
          address: '::1',
          port: 22
        },
        Error: connect ETIMEDOUT 127.0.0.2:22
            at createConnectionError (node:net:1647:14)
            at afterConnectMultiple (node:net:1677:16) {
          errno: -60,
          code: 'ETIMEDOUT',
          syscall: 'connect',
          address: '127.0.0.2',
          port: 22
        }
      ]
    }

This is an AggregateError that can be returned if multiple IP addresses resolve to the same hostname, and the hostname was used to initiate the connection. This is in no way shown to the user, and was coerced with some console.dir(err) statements in error handling (for demonstration/debugging purposes).

@JTonda JTonda added priority-medium Not functioning - next quarter if capacity permits severity-low Bug that makes the usage of the Zowe less convenient but doesn't impact key use cases and removed new The issue wasn't triaged yet labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium Not functioning - next quarter if capacity permits severity-low Bug that makes the usage of the Zowe less convenient but doesn't impact key use cases
Projects
Status: Medium Priority
Development

No branches or pull requests

2 participants