harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Regis Xu (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6225) [classlib][nio] epoll selector provider throw RuntimeException when selecting
Date Fri, 05 Jun 2009 03:03:07 GMT
[classlib][nio] epoll selector provider throw RuntimeException when selecting

                 Key: HARMONY-6225
                 URL: https://issues.apache.org/jira/browse/HARMONY-6225
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M9
            Reporter: Regis Xu

the test case:

        Selector selector = Selector.open();
        SocketChannel channel1 = SocketChannel.open();
        channel1.register(selector, SelectionKey.OP_READ);

        SocketChannel channel2 = SocketChannel.open();
        channel2.register(selector, SelectionKey.OP_READ);

It passed on RI and org.apache.harmony.nio.internal.SelectorImpl provider, but throw RuntimeException:
Exception in thread "main" java.lang.RuntimeException
	at org.apache.harmony.nio.internal.EpollSelectorImpl.delKey(EpollSelectorImpl.java:247)
	at org.apache.harmony.nio.internal.EpollSelectorImpl.doCancel(EpollSelectorImpl.java:477)
	at org.apache.harmony.nio.internal.EpollSelectorImpl.selectInternal(EpollSelectorImpl.java:361)
	at org.apache.harmony.nio.internal.EpollSelectorImpl.selectNow(EpollSelectorImpl.java:353)
	at EpollBug.main(EpollBug.java:25)

After some investigations, I found epoll selector used a "quickMap" to keep the mapping from
FD to SelectionKey. It use operation system FD value as the key which is got by resolveFD
method. Unfortunately FD value is not unique, OS will reuse the value if the old one is closed.
So in the test, channel1 and channel2 have the different SelectionKey but the same FD value,
the conflict cause unexpected behaviors.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message