[JDK-8257080] Java does not try all DNS results when opening a socket
Benjamin Marwell
bmarwell at apache.org
Wed Dec 16 08:09:08 UTC 2020
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.
Workarounds:
None. It is not possible to write an agent which alters java.net classes,
as they are protected.
I would like to bring this issue to your attention. I reported it using my
work mail at oracle’s bug tracker, but I think other applications might
suffer from this as well.
Best regards,
Ben
[1] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8257080
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20201216/b824029e/attachment.htm>
More information about the net-dev
mailing list