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

NIO's connect errors make it impossible to know what it actually tried to connect to #2967

Open
weissi opened this issue Nov 6, 2024 · 2 comments

Comments

@weissi
Copy link
Member

weissi commented Nov 6, 2024

For example if you get a ChannelError.connectTimeout(...) from Channel.connect(host: "foo.com", port: 1234) you don't get told what address(es) NIO actually resolved and tried to connect to. Also, the HappyEyeballsConnector also throws ChannelError.connectTimeout(...) when it times out resolving.

That's quite problematic.

I know that it would be source breaking if NIO just started throwing different errors but to alleviate this we could have a ClientBootstrap (etc) property bootstrap.useModernErrors(true) or similar to opt into better errors.

@weissi
Copy link
Member Author

weissi commented Nov 6, 2024

Ah, I think it's kinda weird:

  • If you connect to host:port: and ...
    • ... the DNS resolution worked but the connect failed, you get a good error (NIOConnectionError) with all detais
    • ... the DNS resolution itself took longer than the connect timeout you get ChannelError.connectTimeout(...)
  • If you connect to a SocketAddress and the connect times out you get a ChannelError.connectTimeout(...)

@Lukasa
Copy link
Contributor

Lukasa commented Nov 7, 2024

Yeah, opting into better errors here is definitely valuable.

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

No branches or pull requests

2 participants