On 4 Mar 2015, at 21:53, Mark Sheppard <mark.shepp...@oracle.com> wrote:

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

I agree with the increased buffer size, and the strategy you have employed. I 
think you just need to remove a few comments, otherwise looks fine to me.

-Chris.

> 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

Reply via email to