Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6947677

InetAddress.isReachable() throws "java.net.SocketException:Invalid argument" on Linux if run as root

    • b118
    • x86
    • linux
    • Verified

        The test case
        api/java_net/InetAddress/complement.html#isReachable
        fails on Linux if run on behalf of root but passed if run on behalf of unprivileged user.

        Testsuite name: JCK 6b
        JDK/JRE tested: 1.6.0_20 b03_jfb
        OS/architecture: linux i586
        Reproducible: Always
        Reproducible on machine: stt-52
        Is it a platform specific regression: Y
        Is it a new platform support: N
        Is it a Regression: N
        Test result on FCS: Fail (1.6.0 FCS)
        Test run log location: N/A
        Steps to reproduce: Just perform class on Linux x86 platfrom with commnd line like below

        [root@stt-52 jdk]# /export/jdk/jdk1.6.0_20_b03/bin/java -cp /set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/classes:/export/jdk/jdk1.6.0_19/lib/tools.jar javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests -network.testHost1 spb-void.russia.sun.com/10.16.106.53
        isReachable001: Passed. OKAY
        isReachable002: Passed. OKAY
        isReachable003: Failed. java.net.SocketException: Invalid argument
        isReachableIf002: Passed. OKAY
        isReachable002: testHost1 spb-void.russia.sun.com/10.16.106.53
        java.net.SocketException: Invalid argument
                at java.net.Inet6AddressImpl.isReachable0(Native Method)
                at java.net.Inet6AddressImpl.isReachable(Inet6AddressImpl.java:59)
                at java.net.InetAddress.isReachable(InetAddress.java:420)
                at javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests.isReachable003(isReachableTests.java:144)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:406)
                at javasoft.sqe.jck.lib.MultiTestExt.invokeTestCase(MultiTestExt.java:55)
                at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
                at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
                at javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests.main(isReachableTests.java:43)
        isReachableIf002: netIntf 'name:eth0 (eth0) index: 2 addresses:
        /fe80:0:0:0:21b:11ff:feb1:ed6%2;
        /fc00:106a:0:0:21b:11ff:feb1:ed6%2;
        /10.16.108.151;
        ', isUp() = true
        STATUS:Failed.test cases: 4; passed: 3; failed: 1; first test case failure: isReachable003

        Looks like a loopback interface is not valid for java.net.InetAddress.isReachable() method if it run on behalf of root user. At least if the line 144 in the test case rewrite with
                    if( ia1.isReachable(null, ttl, HUGE_TIMEOUT ) )
        the host will be reachable. Moreover if the first argument of the method is non loopback interface the Exception will not occur. The exception exists only if the NetworkInterface is loop back interface. Why loopback interface is invalid argument if test started on behalf of root user? ... and valid if it started on behalf of unprivileged user?

        Actually the test isReachable003() is strange. The comment to the method is not correct by my opinion. The test will be passed if the Host will be not reachable (in the comment another description).

        Any way the test passed if it run on behalf of the user without root privileges:
        [stt-robot@stt-52]$ /export/jdk/jdk1.6.0_20_b03/bin/java -cp /set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/classes:/export/jdk/jdk1.6.0_19/lib/tools.jar javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests -network.testHost1 spb-void.russia.sun.com/10.16.106.53
        isReachable001: Passed. OKAY
        isReachable002: Passed. OKAY
        isReachable003: Passed. OK
        isReachableIf002: Passed. OKAY
        isReachable002: testHost1 spb-void.russia.sun.com/10.16.106.53
        isReachableIf002: netIntf 'name:eth0 (eth0) index: 2 addresses:
        /fe80:0:0:0:21b:11ff:feb1:ed6%2;
        /fc00:106a:0:0:21b:11ff:feb1:ed6%2;
        /10.16.108.151;
        ', isUp() = true
        STATUS:Passed.test cases: 4; all passed

        It is Linux specific issue. On Solaris the test passes with root privileges. But! it spend extremely more time with root than with unprivileged user.
        Test name:
        api/java_net/InetAddress/complement_isReachable

            Loading...
            Uploaded image for project: 'JDK'
            1. JDK
            2. JDK-6947677

            InetAddress.isReachable() throws "java.net.SocketException:Invalid argument" on Linux if run as root

              • b118
              • x86
              • linux
              • Verified

                  The test case
                  api/java_net/InetAddress/complement.html#isReachable
                  fails on Linux if run on behalf of root but passed if run on behalf of unprivileged user.

                  Testsuite name: JCK 6b
                  JDK/JRE tested: 1.6.0_20 b03_jfb
                  OS/architecture: linux i586
                  Reproducible: Always
                  Reproducible on machine: stt-52
                  Is it a platform specific regression: Y
                  Is it a new platform support: N
                  Is it a Regression: N
                  Test result on FCS: Fail (1.6.0 FCS)
                  Test run log location: N/A
                  Steps to reproduce: Just perform class on Linux x86 platfrom with commnd line like below

                  [root@stt-52 jdk]# /export/jdk/jdk1.6.0_20_b03/bin/java -cp /set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/classes:/export/jdk/jdk1.6.0_19/lib/tools.jar javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests -network.testHost1 spb-void.russia.sun.com/10.16.106.53
                  isReachable001: Passed. OKAY
                  isReachable002: Passed. OKAY
                  isReachable003: Failed. java.net.SocketException: Invalid argument
                  isReachableIf002: Passed. OKAY
                  isReachable002: testHost1 spb-void.russia.sun.com/10.16.106.53
                  java.net.SocketException: Invalid argument
                          at java.net.Inet6AddressImpl.isReachable0(Native Method)
                          at java.net.Inet6AddressImpl.isReachable(Inet6AddressImpl.java:59)
                          at java.net.InetAddress.isReachable(InetAddress.java:420)
                          at javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests.isReachable003(isReachableTests.java:144)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:597)
                          at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:406)
                          at javasoft.sqe.jck.lib.MultiTestExt.invokeTestCase(MultiTestExt.java:55)
                          at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
                          at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
                          at javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests.main(isReachableTests.java:43)
                  isReachableIf002: netIntf 'name:eth0 (eth0) index: 2 addresses:
                  /fe80:0:0:0:21b:11ff:feb1:ed6%2;
                  /fc00:106a:0:0:21b:11ff:feb1:ed6%2;
                  /10.16.108.151;
                  ', isUp() = true
                  STATUS:Failed.test cases: 4; passed: 3; failed: 1; first test case failure: isReachable003

                  Looks like a loopback interface is not valid for java.net.InetAddress.isReachable() method if it run on behalf of root user. At least if the line 144 in the test case rewrite with
                              if( ia1.isReachable(null, ttl, HUGE_TIMEOUT ) )
                  the host will be reachable. Moreover if the first argument of the method is non loopback interface the Exception will not occur. The exception exists only if the NetworkInterface is loop back interface. Why loopback interface is invalid argument if test started on behalf of root user? ... and valid if it started on behalf of unprivileged user?

                  Actually the test isReachable003() is strange. The comment to the method is not correct by my opinion. The test will be passed if the Host will be not reachable (in the comment another description).

                  Any way the test passed if it run on behalf of the user without root privileges:
                  [stt-robot@stt-52]$ /export/jdk/jdk1.6.0_20_b03/bin/java -cp /set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/classes:/export/jdk/jdk1.6.0_19/lib/tools.jar javasoft.sqe.tests.api.java.net.InetAddress.isReachableTests -network.testHost1 spb-void.russia.sun.com/10.16.106.53
                  isReachable001: Passed. OKAY
                  isReachable002: Passed. OKAY
                  isReachable003: Passed. OK
                  isReachableIf002: Passed. OKAY
                  isReachable002: testHost1 spb-void.russia.sun.com/10.16.106.53
                  isReachableIf002: netIntf 'name:eth0 (eth0) index: 2 addresses:
                  /fe80:0:0:0:21b:11ff:feb1:ed6%2;
                  /fc00:106a:0:0:21b:11ff:feb1:ed6%2;
                  /10.16.108.151;
                  ', isUp() = true
                  STATUS:Passed.test cases: 4; all passed

                  It is Linux specific issue. On Solaris the test passes with root privileges. But! it spend extremely more time with root than with unprivileged user.
                  Test name:
                  api/java_net/InetAddress/complement_isReachable

                        chegar Chris Hegarty
                        afomin Alexander Fomin (Inactive)
                        Votes:
                        0 Vote for this issue
                        Watchers:
                        2 Start watching this issue

                          Created:
                          Updated:
                          Resolved:
                          Imported:
                          Indexed:

                            chegar Chris Hegarty
                            afomin Alexander Fomin (Inactive)
                            Votes:
                            0 Vote for this issue
                            Watchers:
                            2 Start watching this issue

                              Created:
                              Updated:
                              Resolved:
                              Imported:
                              Indexed: