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

NetworkInterface.getNetworkInterfaces() triggers intermittent test failures

    Details

    • Subcomponent:
    • Resolved In Build:
      b55
    • CPU:
      generic
    • OS:
      windows

      Backports

        Description

         ThreadLocalRandom initialization causes sun/net/www/protocol/http/B6369510.java failed intermittently. This due to the initial seed creation using NetworkIntereface.getNetworkInterfaces() for its random number creation. The NetworkIntereface.getNetworkInterfaces() call flow can fail intermittently
        due to GetAdaptersAddresses failing. Further discussion details below.

          This happened once in JDK9/b38 same binaries runs on Windows. It is probably related with teredo pseudo interface, which may change timely.

        The error is like:
        ----------System.err:(31/2081)----------
        java.lang.Error: IP Helper Library GetAdaptersAddresses function failed
        at java.net.NetworkInterface.getAll(Native Method)
        at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:343)
        at java.util.concurrent.ThreadLocalRandom.initialSeed(ThreadLocalRandom.java:153)
        at java.util.concurrent.ThreadLocalRandom.<clinit>(ThreadLocalRandom.java:137)
        at java.util.concurrent.ConcurrentSkipListMap.doPut(ConcurrentSkipListMap.java:857)
        at java.util.concurrent.ConcurrentSkipListMap.putIfAbsent(ConcurrentSkipListMap.java:1962)
        at java.util.concurrent.ConcurrentSkipListSet.add(ConcurrentSkipListSet.java:241)
        at java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:816)
        at java.net.InetAddress.getAllByName0(InetAddress.java:1249)
        at java.net.InetAddress.getAllByName0(InetAddress.java:1169)
        at java.net.InetAddress.getHostFromNameService(InetAddress.java:615)
        at java.net.InetAddress.getHostName(InetAddress.java:540)
        at java.net.InetAddress.getHostName(InetAddress.java:512)
        at java.net.InetSocketAddress$InetSocketAddressHolder.getHostName(InetSocketAddress.java:82)
        at java.net.InetSocketAddress$InetSocketAddressHolder.access$600(InetSocketAddress.java:56)
        at java.net.InetSocketAddress.getHostName(InetSocketAddress.java:345)
        at B6369510.doClient(B6369510.java:63)
        at B6369510.<init>(B6369510.java:52)
        at B6369510.main(B6369510.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
        at java.lang.Thread.run(Thread.java:745)

          Issue Links

            Activity

            Hide
            msheppar Mark Sheppard added a comment -
            the following stackoverflow article highlights a error return of ERROR_INSUFFICIENT_BUFFER rather than ERROR_BUFFER_OVERFLOW
            perhaps this is also an issue here
            http://stackoverflow.com/questions/12279135/error-insufficient-buffer-returned-from-getadaptersaddresses
            Show
            msheppar Mark Sheppard added a comment - the following stackoverflow article highlights a error return of ERROR_INSUFFICIENT_BUFFER rather than ERROR_BUFFER_OVERFLOW perhaps this is also an issue here http://stackoverflow.com/questions/12279135/error-insufficient-buffer-returned-from-getadaptersaddresses
            Hide
            msheppar Mark Sheppard added a comment - - edited
            I've run this test standalone and it throws an exception. The HttpServer is created with a wildcard address, and this
            is retrieved in the call to address.getHostName(). This forms part of the URL string passed to the URL constructor, which the
            URL constructor doesn't like!!.
            If the test is run under jtreg it will nominally pass, but view the test log will show the exception.
            So we need to rectify the test, also. Will create a separate bug
            https://bugs.openjdk.java.net/browse/JDK-8065222
            Show
            msheppar Mark Sheppard added a comment - - edited I've run this test standalone and it throws an exception. The HttpServer is created with a wildcard address, and this is retrieved in the call to address.getHostName(). This forms part of the URL string passed to the URL constructor, which the URL constructor doesn't like!!. If the test is run under jtreg it will nominally pass, but view the test log will show the exception. So we need to rectify the test, also. Will create a separate bug https://bugs.openjdk.java.net/browse/JDK-8065222
            Hide
            chegar Chris Hegarty added a comment -
            This bug appears to run into an issue when trying to retrieve the network interfaces from the machine. The test itself does not directly try to retrieve this information, it is a side-effect of the initialization of ThreadLocalRandom, where it is being used as a source of entropy for an initial seed . There is another bug, JDK-8060435, that is attempting to remove the networking code from the initialization of TLR. The title of this bug may need to be updated so make this clear.
            Show
            chegar Chris Hegarty added a comment - This bug appears to run into an issue when trying to retrieve the network interfaces from the machine. The test itself does not directly try to retrieve this information, it is a side-effect of the initialization of ThreadLocalRandom, where it is being used as a source of entropy for an initial seed . There is another bug, JDK-8060435 , that is attempting to remove the networking code from the initialization of TLR. The title of this bug may need to be updated so make this clear.
            Hide
            xiaofeya Felix Yang added a comment - - edited
            Raise to P3, since it affects so many test cases and a bit of frequently.
            Show
            xiaofeya Felix Yang added a comment - - edited Raise to P3, since it affects so many test cases and a bit of frequently.
            Hide
            msheppar Mark Sheppard added a comment -
            the error code 111 is ERROR_BUFFER_OVERFLOW
            this is handled at certain points in the call flow.
            Thus, based on the call logic it would appear that the realloc is also
            failing to allocate sufficient memory for the memory addresses in the second
            or subsequent GetAdaptersAddresses function call.

            Rather than attempting, another realloc and retry of GetAdaptersAddresses call block
            a simpler remedy might be to increase the bufsize from 1024 to 2048
            Show
            msheppar Mark Sheppard added a comment - the error code 111 is ERROR_BUFFER_OVERFLOW this is handled at certain points in the call flow. Thus, based on the call logic it would appear that the realloc is also failing to allocate sufficient memory for the memory addresses in the second or subsequent GetAdaptersAddresses function call. Rather than attempting, another realloc and retry of GetAdaptersAddresses call block a simpler remedy might be to increase the bufsize from 1024 to 2048
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/c3b558249c32
            User: msheppar
            Date: 2015-03-09 18:46:45 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/c3b558249c32 User: msheppar Date: 2015-03-09 18:46:45 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/c3b558249c32
            User: lana
            Date: 2015-03-18 00:54:38 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/c3b558249c32 User: lana Date: 2015-03-18 00:54:38 +0000

              People

              • Assignee:
                msheppar Mark Sheppard
                Reporter:
                xiaofeya Felix Yang
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: