JDK-8254157 : InetAddress isReachable returns false for reachable known host
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7u161
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2020-10-07
  • Updated: 2023-10-17
  • Resolved: 2020-10-14
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
InetAddress isReachable fails with jdk7u but passes with jdk8u.

Sample Program:

import java.net.InetAddress;

public class Test {
public static void main(String[] args) {
try {
            final InetAddress addr = InetAddress.getByName("hostname");
            final boolean isReachable = addr.isReachable(2000);
            if (!isReachable) {
                System.out.println("Not Reachable");
            } else {
                System.out.println("Reachable");
            }
} catch (Exception e) {
            e.printStackTrace();
}
}
}

Excepted: Reachable
Actual: Not Reachable
Comments
Relates to the following issues: JDK-8166747, JDK-8159410, JDK-8150234, JDK-8143397, JDK-8141260, JDK-8135305, JDK-8133015 Therefore handled in there.
14-10-2020