JDK-7176630 : (sc) SocketChannel.write does not write more than 128k when channel configured blocking [win]
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-06-13
  • Updated: 2014-02-09
  • Resolved: 2012-07-09
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 7 JDK 8
7u6Fixed 8 b45Fixed
Related Reports
Relates :  
Relates :  
Description
Windows does not support asynchronous close on sockets when doing blocking operations with a buffer size >= 128k. The long standing Microsoft recommendation is to limit such I/O operations to 64k. Since 6395224 then we limit I/O operations to 128k-1 so that asynchronous close works as specified but a side effect of this is that attempts to write 128k+ bytes will be result in a short write. This is not an issue for applications that check the return value from write but is a problem for applications that don't check the return value. This bug is submitted to re-visit this issue with a view to the write(ByteBuffer) method writing as many bytes as possible.

Comments
EVALUATION As per the description, we should write as many bytes as possible when in blocking mode.
13-06-2012