United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7159361 (se) Selector.select hang due to poll(2) bug [macosx]
JDK-7159361 : (se) Selector.select hang due to poll(2) bug [macosx]

Details
Type:
Bug
Submit Date:
2012-04-05
Status:
Closed
Updated Date:
2012-09-17
Project Name:
JDK
Resolved Date:
2012-04-16
Component:
core-libs
OS:
os_x
Sub-Component:
java.nio
CPU:
x86
Priority:
P3
Resolution:
Duplicate
Affected Versions:
7u4
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

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
PUBLIC COMMENTS

Session Hang using JDK 7 Update 4 and WLS.
                                     
2012-04-05
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.
                                     
2012-04-06
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.
                                     
2012-04-06
WORK AROUND

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

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

.
                                     
2012-04-25



Hardware and Software, Engineered to Work Together