JDK-8022963 : java/net/NetworkInterface/Equals.java fails equality for Windows Teredo Interface
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2013-08-13
  • Updated: 2020-07-01
  • Resolved: 2013-11-08
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.
JDK 8 Other
8 b117Fixed port-stage-ppc-aixFixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
TESTFAIL:/java/net/NetworkInterface/Equals.java

JavaTest Message: Test threw exception: java.lang.RuntimeException: equality different for net8
   javatestOS=Windows 8 6.2 (amd64)
   hostname=sc11136372.us.oracle.com
   http://aurora.ru.oracle.com/slot-gw/270056.CORELIBS-JDK8-NIGHTLY-JTREG-7/results/workDir/java/net/NetworkInterface/Equals.jtr

I tried reproducing this issue on the same machine and count not. Filing this bug as a placeholder for stability analysis
Comments
Suggested Fix sent to alias: http://mail.openjdk.java.net/pipermail/net-dev/2013-October/007725.html
01-11-2013

Root Cause: This test is too sensitive, the test shouldn't check Windows && Teredo Tunneling Pseudo-Interface. Suggested Fix: Based on Chris' suggestion, we will remove "Windows && Teredo Tunneling Pseudo-Interface" from this test.
01-11-2013

It seems to me that the test is trying to assert something that is not guaranteed by the Operating System. So, I think the test needs to be relaxed somewhat. I hate to do it, but maybe skipped for Windows && virtual interfaces, ( or ones with 'teredo' in their name ), or something else. -Chris.
29-10-2013

Root Cause: I looked at our test and JDK product code, our code is using Windows API GetAdaptersAddresses. This looks like issue of GetAdaptersAddresses. The proof is I took MSDN example forGetAdaptersAddresses a little and changed as below, it turned out for "Teredo Tunneling Pseudo-Interface", sometimes it returns 2 unicast addresses, sometimes it returns 1 unicast address. The code is // GetFamilyAddress.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <winsock2.h> #include <iphlpapi.h> #include <ws2tcpip.h> #include <iphlpapi.h> #include <stdio.h> #include <stdlib.h> // Link with Iphlpapi.lib #pragma comment(lib, "IPHLPAPI.lib") #pragma comment(lib, "ws2_32.lib") #define WORKING_BUFFER_SIZE 15000 #define MAX_TRIES 3 #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) /* Note: could also use malloc() and free() */ int _tmain(int argc, _TCHAR* argv[]) { /* Declare and initialize variables */ DWORD dwSize = 0; DWORD dwRetVal = 0; unsigned int i = 0; // Set the flags to pass to GetAdaptersAddresses ULONG flags = GAA_FLAG_INCLUDE_PREFIX; // default to unspecified address family (both) ULONG family = AF_UNSPEC; LPVOID lpMsgBuf = NULL; PIP_ADAPTER_ADDRESSES pAddresses = NULL; ULONG outBufLen = 0; ULONG Iterations = 0; char buff[100]; DWORD bufflen=100; PIP_ADAPTER_ADDRESSES pCurrAddresses = NULL; PIP_ADAPTER_UNICAST_ADDRESS pUnicast = NULL; PIP_ADAPTER_ANYCAST_ADDRESS pAnycast = NULL; PIP_ADAPTER_MULTICAST_ADDRESS pMulticast = NULL; IP_ADAPTER_DNS_SERVER_ADDRESS *pDnServer = NULL; IP_ADAPTER_PREFIX *pPrefix = NULL; printf("Calling GetAdaptersAddresses function with family = "); if (family == AF_UNSPEC) printf("AF_UNSPEC\n\n"); // Allocate a 15 KB buffer to start with. outBufLen = WORKING_BUFFER_SIZE; do { pAddresses = (IP_ADAPTER_ADDRESSES *) MALLOC(outBufLen); if (pAddresses == NULL) { printf ("Memory allocation failed for IP_ADAPTER_ADDRESSES struct\n"); exit(1); } dwRetVal = GetAdaptersAddresses(family, flags, NULL, pAddresses, &outBufLen); if (dwRetVal == ERROR_BUFFER_OVERFLOW) { FREE(pAddresses); pAddresses = NULL; } else { break; } Iterations++; } while ((dwRetVal == ERROR_BUFFER_OVERFLOW) && (Iterations < MAX_TRIES)); if (dwRetVal == NO_ERROR) { // If successful, output some information from the data we received pCurrAddresses = pAddresses; while (pCurrAddresses) { if(wcsstr(pCurrAddresses->FriendlyName, L"Tunnel") == 0) { pCurrAddresses = pCurrAddresses->Next; continue; } printf("\tLength of the IP_ADAPTER_ADDRESS struct: %ld\n", pCurrAddresses->Length); printf("\tIfIndex (IPv4 interface): %u\n", pCurrAddresses->IfIndex); printf("\tAdapter name: %s\n", pCurrAddresses->AdapterName); pUnicast = pCurrAddresses->FirstUnicastAddress; if (pUnicast != NULL) { for (i = 0; pUnicast != NULL; i++) { if (pUnicast->Address.lpSockaddr->sa_family == AF_INET) { sockaddr_in *sa_in = (sockaddr_in *)pUnicast->Address.lpSockaddr; printf("\tIPV4:%s\n",inet_ntop(AF_INET,&(sa_in->sin_addr),buff,bufflen)); } else if (pUnicast->Address.lpSockaddr->sa_family == AF_INET6) { sockaddr_in6 *sa_in6 = (sockaddr_in6 *)pUnicast->Address.lpSockaddr; printf("\tIPV6:%s\n",inet_ntop(AF_INET6,&(sa_in6->sin6_addr),buff,bufflen)); } else { printf("\tUNSPEC"); } pUnicast = pUnicast->Next; } printf("\tNumber of Unicast Addresses: %d\n", i); } else printf("\tNo Unicast Addresses\n"); pAnycast = pCurrAddresses->FirstAnycastAddress; if (pAnycast) { for (i = 0; pAnycast != NULL; i++) { if (pAnycast->Address.lpSockaddr->sa_family == AF_INET) { sockaddr_in *sa_in = (sockaddr_in *)pAnycast->Address.lpSockaddr; printf("\tIPV4:%s\n",inet_ntop(AF_INET,&(sa_in->sin_addr),buff,bufflen)); } else if (pAnycast->Address.lpSockaddr->sa_family == AF_INET6) { sockaddr_in6 *sa_in6 = (sockaddr_in6 *)pAnycast->Address.lpSockaddr; printf("\tIPV6:%s\n",inet_ntop(AF_INET6,&(sa_in6->sin6_addr),buff,bufflen)); } else { printf("\tUNSPEC"); } pAnycast = pAnycast->Next; } printf("\tNumber of Anycast Addresses: %d\n", i); } else printf("\tNo Anycast Addresses\n"); pMulticast = pCurrAddresses->FirstMulticastAddress; if (pMulticast) { for (i = 0; pMulticast != NULL; i++) { if (pMulticast->Address.lpSockaddr->sa_family == AF_INET) { sockaddr_in *sa_in = (sockaddr_in *)pMulticast->Address.lpSockaddr; printf("\tIPV4:%s\n",inet_ntop(AF_INET,&(sa_in->sin_addr),buff,bufflen)); } else if (pMulticast->Address.lpSockaddr->sa_family == AF_INET6) { sockaddr_in6 *sa_in6 = (sockaddr_in6 *)pMulticast->Address.lpSockaddr; printf("\tIPV6:%s\n",inet_ntop(AF_INET6,&(sa_in6->sin6_addr),buff,bufflen)); } else { printf("\tUNSPEC"); } pMulticast = pMulticast->Next; } printf("\tNumber of Multicast Addresses: %d\n", i); } else printf("\tNo Multicast Addresses\n"); pDnServer = pCurrAddresses->FirstDnsServerAddress; if (pDnServer) { for (i = 0; pDnServer != NULL; i++) pDnServer = pDnServer->Next; printf("\tNumber of DNS Server Addresses: %d\n", i); } else printf("\tNo DNS Server Addresses\n"); printf("\tDNS Suffix: %wS\n", pCurrAddresses->DnsSuffix); printf("\tDescription: %wS\n", pCurrAddresses->Description); printf("\tFriendly name: %wS\n", pCurrAddresses->FriendlyName); if (pCurrAddresses->PhysicalAddressLength != 0) { printf("\tPhysical address: "); for (i = 0; i < (int) pCurrAddresses->PhysicalAddressLength; i++) { if (i == (pCurrAddresses->PhysicalAddressLength - 1)) printf("%.2X\n", (int) pCurrAddresses->PhysicalAddress[i]); else printf("%.2X-", (int) pCurrAddresses->PhysicalAddress[i]); } } printf("\tFlags: %ld\n", pCurrAddresses->Flags); printf("\tMtu: %lu\n", pCurrAddresses->Mtu); printf("\tIfType: %ld\n", pCurrAddresses->IfType); printf("\tOperStatus: %ld\n", pCurrAddresses->OperStatus); printf("\tIpv6IfIndex (IPv6 interface): %u\n", pCurrAddresses->Ipv6IfIndex); printf("\tZoneIndices (hex): "); for (i = 0; i < 16; i++) printf("%lx ", pCurrAddresses->ZoneIndices[i]); printf("\n"); printf("\tTransmit link speed: %I64u\n", pCurrAddresses->TransmitLinkSpeed); printf("\tReceive link speed: %I64u\n", pCurrAddresses->ReceiveLinkSpeed); pPrefix = pCurrAddresses->FirstPrefix; if (pPrefix) { for (i = 0; pPrefix != NULL; i++) pPrefix = pPrefix->Next; printf("\tNumber of IP Adapter Prefix entries: %d\n", i); } else printf("\tNumber of IP Adapter Prefix entries: 0\n"); printf("\n"); pCurrAddresses = pCurrAddresses->Next; } } else { printf("Call to GetAdaptersAddresses failed with error: %d\n", dwRetVal); if (dwRetVal == ERROR_NO_DATA) printf("\tNo addresses were found for the requested parameters\n"); else { if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwRetVal, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) & lpMsgBuf, 0, NULL)) { printf("\tError: %s", lpMsgBuf); LocalFree(lpMsgBuf); if (pAddresses) FREE(pAddresses); exit(1); } } } if (pAddresses) { FREE(pAddresses); } return 0; }
23-10-2013

Chris: I am not sure what causes the address change. But it's very interesting this only happens in the same interface "Teredo Tunneling Pseudo-Interface ", in my 1000 loops test execution and it failed 7~8 times.
23-10-2013

This is an intermittent test failure. This could be reproduced in target machine with 1000 loops. Debug info as below: this.addrs.length=1 address =/fe80:0:0:0:0:ffff:ffff:fffe%net8 that.addrs.length=2 address =/2001:0:9d38:953c:84d:1290:f57a:7429 address =/fe80:0:0:0:84d:1290:f57a:7429%net8 Expected the following interfaces to be the same: Display name: Teredo Tunneling Pseudo-Interface Name: net8 Up? false Loopback? false PointToPoint? true Supports multicast? false Virtual? false Hardware address: null MTU: 1280 Index: 20 Display name: Teredo Tunneling Pseudo-Interface Name: net8 Up? false Loopback? false PointToPoint? true Supports multicast? false Virtual? false Hardware address: null MTU: 1280 Index: 20
23-10-2013

Tristan: having access to a machine that reproduces this intermittent failure, does it appear that the addresses of the problematic interface are being mixed up with addresses of another interface, or that the addresses are changing on the underlying interface ( and the java test program is racing with the OS/system ).
03-10-2013

Assigning to Tristan to fix
02-10-2013