JDK-6353684 : Unnecessary service name in getaddrinfo calls
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-11-21
  • Updated: 2010-04-02
  • Resolved: 2005-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u7Fixed 6 b63Fixed
Related Reports
Relates :  
Description
In the native implementation of Inet6AddressImpl, both for Solaris/Linux and Windows there are calls to getaddrinfo() for name resolution (IPv6 equivalent of gethostbyname()) that are requesting unnecessary information. i.e. the calls pass the string "domain" as a second argument, which, in effect, will do the equivalent of getservbyname("domain") along with the host name resolution.
While there is nothing inhenrently bogus about this, the extra information requested (port number for DNS) is not used.
It is both a performance issue (albeit a minor one) and an extra potential breaking point (if the service name database, usually /etc/services, get corrupted the call may fail).

I recommend replacing the "domain" litteral string by a NULL, which tells the function to only do host name resolution.

Comments
EVALUATION See description. Changes are minimal and could have a significant impact.
21-11-2005