JDK-2147719 : (se) Selector doesn't block on Selector.select(timeout) (lnx)
  • Type: Backport
  • Backport of: JDK-6403933
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2007-03-16
  • Updated: 2011-02-22
  • Resolved: 2007-07-21
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.
6u4 b02Fixed 7Fixed
This is an issue with poll (and epoll) on Linux. If a file descriptor for a connected socket is polled with a request event mask of 0, and if the connection is abruptly terminated (RST) then the poll wakes up with the POLLHUP (and maybe POLLERR) bit set in the returned event set. The implication of this behaviour is that Selector will wakeup and as the interest set for the SocketChannel is 0 it means there aren't any selected events and the select method returns 0.

EVALUATION Sending in Fix Available.

SUGGESTED FIX The issue requires changes to two of our Selector implementation (the poll and epoll implementations). The changes to the epoll Selector are straight-forward but the changes to the poll Selector are not. Fix: Change in code of EPollArrayWrapper.java and a test case has been added: CloseWhenKeyIdle.java