On 16/12/2020 08:09, Benjamin Marwell wrote:
Hello everyone,

I would like to bring up the enhancement JDK-8257080[1] on this mailing list.

tl;dr symptoms:
Java will use the first IP address from DNS and will fail to connect when the target host is offline, even when the other IPs would have worked. This is also true for the more recent Socket implementations from Java 14 onwards..

Proposed resolution:
Implementation similar to python. Late(r) DNS resolution when the socket is being opened (i.e. a target port is known), then iterate over IP addresses returned by DNS and try a socket_open.

I can't tell if your proposal is focused on the Socket constructors that take a hostname or more generally changing all APIs that connect to a SocketAddress to support connecting to an isUnresolved InetSocketAddress. There is merit into exploring this, as is exploring new APIs. Experience with Python and other run-times would be useful. I could imagine prototypes that range from a simple API that iterates through the IP address to implementations of the Happy Eyeballs RFC and other algorithms to improve the user experience when a connection is slow to establish. There is synergy between such exploration and other efforts, including the ongoing work to add a service provider interface for name resolution that will open the door to improved APIs for user facing applications.

-Alan

Reply via email to