JDK-8200304 : TwoStacksPlainDatagramSocketImpl and socket cleaner
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 11
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2018-03-27
  • Updated: 2018-06-27
  • Resolved: 2018-03-29
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 11
11 b07Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
JDK-8195059 updated the socket implementation to use a cleaner, rather than the previous finalizer implementation. Unfortunately the TwoStacksPlainDatagramSocketImpl on Windows, that uses two native file descriptors, may close one or other when binding, or it may in fact close both sockets and create two completely new ones.  This is problematic since the cleaner has been registered with the native file descriptors of the original `fd` and `fd1` when the impl was created.
Comments
This area of code is ultimately destined for replacement with the dual stack implementation, but unfortunately we���re not quite at that point yet, so I would like to resolve this issue with a small localised fix that checks the file descriptors before and after the actual bind call, unregistering and re-registering the cleaner as necessary. http://cr.openjdk.java.net/~chegar/8200304/02/ Before this change many net and nio tests have been observed to fail with "java.io.IOException: An operation was attempted on something that is not a socket ���, or ���java.io.IOException: Socket operation on nonsocket���. With this change no such failures are observed in several hundreds of tier2 test runs.
29-03-2018