JDK-7084560 : Crash in net.dll
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2008
  • CPU: unknown
  • Submitted: 2011-08-29
  • Updated: 2013-06-26
  • Resolved: 2011-09-20
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 7 JDK 8
7u40Fixed 8 b06Fixed
Description
Hello everybody,

I got one crash issue on OpenJDK7 windows build.

I captured the stack trace of such a crash, which happens intermittently on my 64bit Windows 2008 server. But unfortunately I have no simple test case to reproduce this problem.

RtlInterlockedFlushSList+0x2ea (0x779F2A7F [ntdll+0x32a7f])
RtlInterlockedFlushSList+0x572 (0x779F2D07 [ntdll+0x32d07])
RtlInterlockedFlushSList+0x45d (0x779F2BF2 [ntdll+0x32bf2])
HeapFree+0x14 (0x755A14D1 [kernel32+0x114d1])
free+0x1c (0x7284016A [msvcr100+0x1016a])
free_netaddr+0x11 (networkinterface.c:107, 0x725A12AC [net+0x12ac])
getAllInterfacesAndAddresses+0xb6 (networkinterface_winxp.c:199, 0x725AB4C8 [net+0xb4c8])
Java_java_net_NetworkInterface_getAll_XP+0x12 (networkinterface_winxp.c:693, 0x725AB7AB [net+0xb7ab])

From the code at src/windows/native/java/net/NetworkInterface_winXP.c:195, I believe it is the dangling pointers that caused this problem. The uninitialized pointer netaddrP is exceptionally freed if the call to Windows API "GetIpAddrTable()" fails.

Comments
EVALUATION Suggested fix contributed by IBM. Looks fine.
29-08-2011

SUGGESTED FIX Here's the updated patch: diff -r 9b8c96f96a0f src/windows/native/java/net/NetworkInterface.c --- a/src/windows/native/java/net/NetworkInterface.c Mon Jun 27 13:21:34 2011 -0700 +++ b/src/windows/native/java/net/NetworkInterface.c Mon Aug 29 17:02:56 2011 +0800 @@ -504,8 +504,7 @@ */ if (netaddrCount < 0) { netaddrCount = enumAddresses_win(env, ifs, &netaddrP); - if ((*env)->ExceptionOccurred(env)) { - free_netaddr(netaddrP); + if (netaddrCount == -1) { return NULL; } } diff -r 9b8c96f96a0f src/windows/native/java/net/NetworkInterface_winXP.c --- a/src/windows/native/java/net/NetworkInterface_winXP.c Mon Jun 27 13:21:34 2011 -0700 +++ b/src/windows/native/java/net/NetworkInterface_winXP.c Mon Aug 29 17:02:56 2011 +0800 @@ -194,8 +194,7 @@ while (curr != NULL) { netaddr *netaddrP; ret = enumAddresses_win(env, curr, &netaddrP); - if ((*env)->ExceptionOccurred(env)) { - free_netaddr(netaddrP); + if (ret == -1) { return -1; } curr->addrs = netaddrP; @@ -449,8 +448,7 @@ */ if (netaddrCount < 0) { netaddrCount = enumAddresses_win(env, ifs, &netaddrP); - if ((*env)->ExceptionOccurred(env)) { - free_netaddr(netaddrP); + if (count == -1) { return NULL; } }
29-08-2011