JDK-7133499 : (fc) FileChannel.read not preempted by asynchronous close on OS X
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7,7u4
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: unknown,x86
  • Submitted: 2012-01-26
  • Updated: 2014-07-29
  • Resolved: 2014-01-22
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 8 JDK 9
8u20Fixed 9 b03Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
From http://java.net/jira/browse/MACOSX_PORT-229 --

Build: b201
Keywords: test-fail-macos
Tests failed (Regression):
RULE java/nio/channels/AsyncCloseAndInterrupt.java any any

Comments
After this fix the attached test case no longer works on OS X with Java 1.8.0_20-ea-b21. It fails with the following exception: java.io.IOException: Unknown error: 316 at sun.nio.ch.NativeThread.signal(Native Method) at sun.nio.ch.DatagramChannelImpl.implCloseSelectableChannel(DatagramChannelImpl.java:1012) at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(AbstractSelectableChannel.java:234) at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:115) at UDPListenerTest$ListenerThread.terminate(UDPListenerTest.java:70) at UDPListenerTest.shutdown(UDPListenerTest.java:30) at UDPListenerTest.main(UDPListenerTest.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
08-07-2014

I've put a preliminary patch for this issue here: http://cr.openjdk.java.net/~alanb/7133499/webrev/
19-01-2014

EVALUATION Asynchronous close of file channel operations is not currently working on Mac OS X. There are two parts to this, one is the changes in the suggested fix section that will use the SIGIO signal to unblock threads that are blocked in I/O operations, the second part is that the implementation assumes that dup2 will close the file descriptor without blocking indefinitely. Unfortunately on the Mac, dup2 will block indefinitely. This may not be fixable for 7u4.
29-01-2012