RFR: 8267564: JDK-8252971 causes SPECjbb2015 socket exceptions on Windows when MKS is installed

Michael McMahon michaelm at openjdk.java.net
Fri Jun 4 08:21:59 UTC 2021


On Fri, 4 Jun 2021 07:39:30 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Hi,
>> 
>> This fixes a problem where unix domain sockets are available on Windows from third party winsock drivers (other than the Microsoft implementation in Windows 10/2019). These are available (unexpectedly) on earlier Windows releases and are not supported by Java. 
>> 
>> The fix is to search for the expected winsock service provider ID and specifically use that one when creating sockets. Previously, we just attempted to create a unix domain socket, and once that succeeded we assumed we had the right service provider.
>> 
>> I haven't included a regression test because the environment to reproduce the issue is not part of the standard test configuration. Also, the new code is well exercised by existing tests.
>> 
>> Thanks,
>> Michael.
>
> src/java.base/windows/native/libnio/ch/UnixDomainSockets.c line 28:
> 
>> 26: #ifndef UNICODE
>> 27: #define UNICODE 1
>> 28: #endif
> 
> Setting UNICODE has wider impact, can you explain why you are adding this? Does it go away if WSASocketW is used instead?

That was why I only set it in this file, but using WSASocketW and WSAEnumProtocolsW (and the corresponding W data types) seems to work.

> src/java.base/windows/native/libnio/ch/UnixDomainSockets.c line 140:
> 
>> 138:             break;
>> 139:         }
>> 140:     }
> 
> The control flow can be simplified to avoid having continue and break in the loop.

Okay

-------------

PR: https://git.openjdk.java.net/jdk/pull/4339


More information about the nio-dev mailing list