JDK-6481709 : (se) epoll based Selector throws java.io.IOException: Operation not permitted during load
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: generic,x86
  • Submitted: 2006-10-13
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
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 6 JDK 7
6u1Fixed 7 b03Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
robo@troll:~/src/java/RabbIT3$ ~/pkg/java/jdk1.6.0/bin/java -version
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b100)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-rc-b100, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux troll 2.6.15-23-amd64-generic #1 SMP PREEMPT Tue May 23 13:45:47 UTC 2006 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
Trying to run ab2 to benchmark the rabbit proxy, http://www.khelekore.org/rabbit/

Download the proxy, and start it, then run:
ab2 -n10000 -c50 -X localhost:9666 http://www.khelekore.org/~robo/arcs.png

With java/5 (1.5.0._08) everything works without problems.

With java/6 I get frequent but random:
java.io.IOException: Operation not permitted
        at sun.nio.ch.EPollArrayWrapper.epollCtl(Native Method)
        at sun.nio.ch.EPollArrayWrapper.updateRegistrations(EPollArrayWrapper.java:202)
        at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:183)
        at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
        at rabbit.proxy.HttpProxy.run(HttpProxy.java:394)
        at java.lang.Thread.run(Thread.java:619)


And ab2 say something like
Benchmarking www.khelekore.org [through localhost:9666] (be patient)
apr_recv:  (104)
  Total of 399 requests completed


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Download the proxy from http://www.khelekore.org/rabbit/   and start it, then run:
ab2 -n10000 -c50 -X localhost:9666 http://www.khelekore.org/~robo/arcs.png



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No errors.
ACTUAL -
proxy crashes and fails to respond.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
ava.io.IOException: Operation not permitted
        at sun.nio.ch.EPollArrayWrapper.epollCtl(Native Method)
        at sun.nio.ch.EPollArrayWrapper.updateRegistrations(EPollArrayWrapper.java:202)
        at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:183)
        at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
        at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
        at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
        at rabbit.proxy.HttpProxy.run(HttpProxy.java:394)
        at java.lang.Thread.run(Thread.java:619)


REPRODUCIBILITY :
This bug can be reproduced often.

CUSTOMER SUBMITTED WORKAROUND :
stay with java/5

Comments
EVALUATION -- We plan to putback the fix for this bug in an early build of jdk7. Once the fix is well baked we will seek to include it in an update release of jdk6.
09-11-2006

EVALUATION This is really hard to duplicate but the submitter has made strace output available to help diagnose the issue. The bug arises when the file descriptor in a pending registration is recycled as non-pollable file descriptor. The fix requires that the pending registration list be flushed of the add/mod/del commands when the channel is killed. This can be optimized further to avoid removing the file descriptor from epoll (which happens automatically when the file descriptor is closed). As we can't duplicate this issue, the submitter has agreed to help and test out the fix for us in the next few days.
13-10-2006