RFR: JDK-8065078 - NetworkInterface.getNetworkInterfaces() triggers intermittent test failures

Mark Sheppard mark.sheppard at oracle.com
Wed Mar 4 21:53:32 UTC 2015


Hi
    please oblige and review the following small change
http://cr.openjdk.java.net/~msheppar/8065078/webrev/

to address the issue raised in
https://bugs.openjdk.java.net/browse/JDK-8065078

the getAdapters and getAdpater functions were amended in
to add additional diagnostic of the error code, in the event of a
failure, following the second invocation of GetAdpatersAddresses in the 
call flows.
This has shown that the  ERROR_BUFFER_OVERFLOW (i.e. 111)
can occur even though the buffer, to hold the addresses, has been realloced
to the size as per that returned in the variable len
from the initial GetAdapatersAddresses. Thus, it is possible to have a 
"race condition" where
configuration changes are taking place simultaneously to
the NetworkInterface.getNetworkInterfaces() call

The proposed change increases the initial size of the addresses buffer 
to 4096,
and in the event of a failure increases the returned buffer size by this 
amount again.

Additionally, the update of the static variable bufsize, after the 
realloc, was seen as potentially problematic
and has thread safe implications, so these updates have been removed. 
The shared variable is not protected
by a mutex during read and write of variable.

regards
Mark


More information about the net-dev mailing list