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

[QUIC] Try every ip address on host connection #99204

Closed

Conversation

liveans
Copy link
Member

@liveans liveans commented Mar 3, 2024

Iterates every IP address that we get from DNS resolution and try to connect each of them.

Contributes to #82404.

@ghost
Copy link

ghost commented Mar 3, 2024

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Iterates every IP address that we get from DNS resolution and try to connect each of them.

Contributes to #82404.

Author: liveans
Assignees: liveans
Labels:

area-System.Net

Milestone: -

Comment on lines +81 to +84
if (options.HandshakeTimeout != Timeout.InfiniteTimeSpan && options.HandshakeTimeout != TimeSpan.Zero)
{
linkedCts.CancelAfter(options.HandshakeTimeout);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is desired behavior, but currently if we are not successful to connect every ip address that we get from DNS resolution, we're going to throw this:
System.Net.Sockets.SocketException : A socket operation was attempted to an unreachable host.

instead of ConnectionTimeout

cc @ManickaP

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO unreachable host is better error message than connection timeout. ConnectionTimeout implies we reached the host but the host was slow in completing the connection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in sockets the exception depends on the condition. If the port is closed and actively refusing connection via RST or ICMP we would get unreachable error, if it fails on timeout e.g. no response we would throw the timeout. Note that for tests on loopback there is observable difference between Windows and Linux.

@ghost
Copy link

ghost commented Mar 3, 2024

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Iterates every IP address that we get from DNS resolution and try to connect each of them.

Contributes to #82404.

Author: liveans
Assignees: liveans
Labels:

area-System.Net.Quic

Milestone: -

{
if (options.HandshakeTimeout != Timeout.InfiniteTimeSpan && options.HandshakeTimeout != TimeSpan.Zero)
{
linkedCts.CancelAfter(options.HandshakeTimeout);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels this is wrong. I think the options.HandshakeTimeout should cover timeout for ConnectAsync itself not for each address we try. In practice the observed timeout would depend on number of addresses given host resolves to.

But we do not have any real explanation
https://learn.microsoft.com/en-us/dotnet/api/system.net.quic.quicconnectionoptions.handshaketimeout?view=net-9.0

On the other hand, It already has CancellationToken to it somewhat feels duplicate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants