-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Support RFC 8305 (Happy Eyeballs v2) in std.net.dns #795
Comments
We can implement this by spawning one process per IP address, then have them use e.g. The problem is that we don't have a way to cancel an existing connection attempt, so if we have 3 sockets with a timeout of 100 msec and one succeeds, the others will continue to try and connect until they time out. |
Reading through the RFC more, it seems we technically don't need to do anything in parallel:
So if I'm understanding it correctly, combined with interleaving IPs (V6 -> V4 -> V6, etc), it seems to just come down to this:
This does mean that if you have e.g. 4 IPs and they all time out, you'd have to wait 1 second in total, whereas a parallel connection setup would only require 250 msec in the worst case. The downside of parallel connections is that this can easily lead to network congestion, especially if you end up with M processes trying to make N parallel connections, where either M or N is large (or both are). |
Small correction: it seems that per the RFC, the initial attempts are made sequentially but we still wait for any of those connections to produce a socket. That is, we do something like this:
|
This fixes #795. Changelog: added
This changes TcpClient.new and TcpClient.with_timeout to support connecting to multiple IP addresses based on RFC 8305, also known as "Happy Eyeballs version 2". In addition, TcpClient.new now uses a default timeout of 60 seconds instead of waiting forever, and std.time.Duration is extended with a few extra methods such as Duration.positive? and Duration./. This fixes #795. Changelog: added
This changes TcpClient.new and TcpClient.with_timeout to support connecting to multiple IP addresses based on RFC 8305, also known as "Happy Eyeballs version 2". In addition, TcpClient.new now uses a default timeout of 60 seconds instead of waiting forever, and std.time.Duration is extended with a few extra methods such as Duration.positive? and Duration./. This fixes #795. Changelog: added
Work on this is taking place in the happy-eyeballs branch. This revealed some issues with That case has been fixed, but I think there may be another similar case: if a
To fix this,
In theory we could represent this using With this in place, |
There's another potential issue with the above: if we start storing reusable |
One option is that
Using this approach a
When calling When calling
|
This changes TcpClient.new and TcpClient.with_timeout to support connecting to multiple IP addresses based on RFC 8305, also known as "Happy Eyeballs version 2". In addition, TcpClient.new now uses a default timeout of 60 seconds instead of waiting forever, and std.time.Duration is extended with a few extra methods such as Duration.positive? and Duration./. This fixes #795. Changelog: added
This changes TcpClient.new and TcpClient.with_timeout to support connecting to multiple IP addresses based on RFC 8305, also known as "Happy Eyeballs version 2". In addition, TcpClient.new now uses a default timeout of 60 seconds instead of waiting forever, and std.time.Duration is extended with a few extra methods such as Duration.positive? and Duration./. This fixes #795. Changelog: added
This changes TcpClient.new and TcpClient.with_timeout to support connecting to multiple IP addresses based on RFC 8305, also known as "Happy Eyeballs version 2". In addition, TcpClient.new now uses a default timeout of 60 seconds instead of waiting forever, and std.time.Duration is extended with a few extra methods such as Duration.positive? and Duration./. This fixes #795. Changelog: added
Future.get_until now always consumes self and returns an Option[uni T] instead of Result[uni T, Future[T]]. The reason for this is that the use of a timeout makes this method very racy and it's difficult to efficiently handle cases where an Error is returned. For example, if a value is written to a Promise _just_ after Future.get_until returns, one would have to resort to a busy loop to observe the value at some point. Consuming self in Future.get_until means that the Future is dropped upon a timeout, disconnecting its Promise and forcing calls to Promise.set to either discard the value or retry the operation in some way (e.g. by using a new Future/Promise pair). For more details, refer to #795 (comment) and the comments that follow it. Changelog: changed
This changes TcpClient.new and TcpClient.with_timeout to support connecting to multiple IP addresses based on RFC 8305, also known as "Happy Eyeballs version 2". In addition, TcpClient.new now uses a default timeout of 60 seconds instead of waiting forever, and std.time.Duration is extended with a few extra methods such as Duration.positive? and Duration./. This fixes #795. Changelog: added
Description
In commit 3d2d34b we added support for performing DNS lookups, resolving #735. While the implementation supports connecting to IPs in the order preferred by the DNS server, we don't actually implement RFC 8503 such as by limiting the amount of time spent on establishing a connection.
Related work
The text was updated successfully, but these errors were encountered: