Details
-
Bug
-
Resolution: Fixed
-
P3
-
6, 7, 8
-
b113
-
generic
-
linux
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8069595 | 7u85 | Brian Burkhalter | P3 | Resolved | Fixed | b01 |
JDK-8071605 | 7u80 | Brian Burkhalter | P3 | Resolved | Fixed | b07 |
Description
SYNOPSIS
--------
Improve Java's handling of EAGAIN with respect to DNS lookups
OPERATING SYSTEM
----------------
Observed on Linux, but probably applicable to all platforms
FULL JDK VERSION
----------------
All
DESCRIPTION
-----------
Occasionally, the system call getaddrinfo() fails with a return value EAI_SYSTEM and errno set to EAGAIN, meaning that the resource is temporarily unavailable. Under these circumstances Java throws an UnknownHostException, which can cause confusion for application users. We believe that Java's handing of this error needs to be improved.
We experimented with a standalone C program and found that the failure is highly transient - calling getaddrinfo() again after 50ms almost always succeeds.
The JRE's handling of this scenario could therefore be improved. Here are two suggestions:
1. Implement a retry when confronted with an EAGAIN error from the
system call.
OR
2. Redesign the Java API to distinguish between true lookup failures and
EAGAIN failures, via the introduction of a new Exception class, to
allow applications to handle the different error scenarios.
WORKAROUND
----------
The application could catch all UnknownHostExceptions and retry just in case the error was an EAGAIN, but this is obviously far from ideal.
--------
Improve Java's handling of EAGAIN with respect to DNS lookups
OPERATING SYSTEM
----------------
Observed on Linux, but probably applicable to all platforms
FULL JDK VERSION
----------------
All
DESCRIPTION
-----------
Occasionally, the system call getaddrinfo() fails with a return value EAI_SYSTEM and errno set to EAGAIN, meaning that the resource is temporarily unavailable. Under these circumstances Java throws an UnknownHostException, which can cause confusion for application users. We believe that Java's handing of this error needs to be improved.
We experimented with a standalone C program and found that the failure is highly transient - calling getaddrinfo() again after 50ms almost always succeeds.
The JRE's handling of this scenario could therefore be improved. Here are two suggestions:
1. Implement a retry when confronted with an EAGAIN error from the
system call.
OR
2. Redesign the Java API to distinguish between true lookup failures and
EAGAIN failures, via the introduction of a new Exception class, to
allow applications to handle the different error scenarios.
WORKAROUND
----------
The application could catch all UnknownHostExceptions and retry just in case the error was an EAGAIN, but this is obviously far from ideal.
Attachments
Issue Links
- backported by
-
JDK-8069595 getaddrinfo can fail with EAI_SYSTEM/EAGAIN, causes UnknownHostException to be thrown
- Resolved
-
JDK-8071605 getaddrinfo can fail with EAI_SYSTEM/EAGAIN, causes UnknownHostException to be thrown
- Resolved
- relates to
-
JDK-8026806 Incomplete test of getaddrinfo() return value could lead to incorrect exception for Windows Inet 6
- Resolved