JDK-8232673 : (dc) DatagramChannel socket adaptor issues
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 14
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-10-20
  • Updated: 2020-02-12
  • Resolved: 2019-11-02
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 14
14 b22Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Description
There are several socket adaptor issues that should be fixed:

1. The socket adaptor send method blocks when another thread is blocked in receive.

2. The send/receive methods create a ByteBuffer for each I/O operation.

3. DatagramPacket has issues (under discussion in JDK-8232817) that may require workarounds in the receive method.

4. The connect method fails if already connected.

5. DatagramSocket connect(SocketAddress) and connect(InetAddress, int) specify IAE is thrown when the address is null, the adaptor throws NPE.

6. DatagramSocket getLocalSocketAddress specifies that null is returned when the socket is closed but the adaptor returns the local address (if bound before the socket was closed).

Maybe for another issue but this area needs more complete tests to ensure that the adaptor behaves the same as DatagramSocket for bad input and closed socket cases.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/5573a7098439 User: alanb Date: 2019-11-02 10:59:36 +0000
02-11-2019

I'm attached a patch that addresses these issues. More tests needed before it will be ready for code review.
24-10-2019