|
Quick Lists
|
|
Bug ID:
|
4379243
|
|
Votes
|
2
|
|
Synopsis
|
InetAddress.toString() causes DNS lookup -- can result in delay
|
|
Category
|
java:classes_net
|
|
Reported Against
|
1.3
|
|
Release Fixed
|
|
|
State
|
11-Closed, duplicate of 4239141,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4239141
|
|
Submit Date
|
13-OCT-2000
|
|
Description
|
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Calling the java.net.InetAddress.toString() method returns both the hostname
and the host address, separated by a slash. To obtain the hostname, a DNS
lookup may be performed.
The documentation for toString() only says, "Converts this IP address to a
String." It doesn't indicate that a DNS lookup for the hostname could happen.
The toString() method should be changed to return only the result of
getHostAddress(). A DNS lookup can fail, and can take several seconds to
evaluate. In our case, several hundred machines are connecting within the
space of a few seconds, and for each we log a message including the result of
the InetAddress.toString(). The DNS lookup fails for many of these machines,
and it takes over 8 minutes to handle the connections.
Please either: 1) remove the getHostName() call from within toString(); or 2)
modify the documentation so it is clear that both getHostAddress() and
getHostName() are being called from within toString(), and that getHostName()
can result in a DNS lookup if the name is not already cached.
(Review ID: 110847)
======================================================================
|
|
Work Around
|
Subclass InetAddress and replace the toString() function with a call to
getHostAddress().
======================================================================
|
|
Evaluation
|
N/A
|
|
Comments
|
Submitted On 13-NOV-2000
ubiquity
I don't buy the "Workaround". It is not possible to
subclass InetAddress, at least usefully, since InetAddress
objects can only be created via InetAddress static methods
(getAllByName(), for instance). It's possible to create a
wrapper, I guess, but this is somewhat tedious. Perhaps
when IPv6 support is added, this would be a good time to
sort this problem out. -jo
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |