JDK-7159361 : (se) Selector.select hang due to poll(2) bug [macosx]
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-04-05
  • Updated: 2017-02-09
  • Resolved: 2012-04-16
Related Reports
Duplicate :  
Description
A session hang is observed when using JDK 7 Update b18 on Mac with WLS 1212-dev kit.  Using a simple HelloWorld web app, long delays are observed when requesting the JSP after its first use.  The request can take 10s of seconds to return.  However, if the request is canceled, then quickly  tried again it succeeds.  This doesn't happen with the latest JDK 6 Update 31 on Mac OSX 10.3, nor does it happen with JDK 7 Update 4 on other OSes.

Comments
EVALUATION .
25-04-2012

EVALUATION This has been fixed by changes to stablize and the KQueue based Selector the default.
16-04-2012

WORK AROUND run WLS with -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.KQueueSelectorProvider
06-04-2012

EVALUATION The EBADF problem happens when the server closes the connection after being idle for 30 seconds. If the client sets the keep alive timeout to 30 seconds or less, then the client closes the connection cleanly and there is no problem.
06-04-2012

EVALUATION The problem seems to be the Mac OS X poll() bug. What is happening is that the first http transaction suceeeds and the second one is attempted by the browser on the same tcp connection. It hangs because it is blocked in poll(), which doesn't wakeup on the presence of new data. When the keep-alive timer expires on the server, the server closes the connection because it doesn't see any data. The client then repeats the request on a second connection, which succeeds immediately. if you wait for the (kept-alive) TCP connection to be closed, before making the second request then it returns immediately (because it is happening on a new connection). The problem seems to be fixed by replacing the poll() code with an emulation based on select(). However, this seems to create other problems when connections timeout. select() returning EBADF.
06-04-2012

PUBLIC COMMENTS Session Hang using JDK 7 Update 4 and WLS.
05-04-2012