HttpComponents HttpCore
  1. HttpComponents HttpCore
  2. HTTPCORE-226

java.nio.channels.IllegalSelectorException on Google Android

    Details

      Description

      The stack trace when "reactor.execute(eventDispatch)":
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): java.nio.channels.IllegalSelectorException
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:158)
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): at java.nio.channels.SelectableChannel.register(SelectableChannel.java:158)
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processSessionRequests(DefaultConnectingIOReactor.java:244)
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:97)
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:317)
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): at io.DownloadClient.run(DownloadClient.java:168)
      04-30 03:26:01.023: ERROR/AndroidRuntime(203): at java.lang.Thread.run(Thread.java:1096)

      The nio underlyings on Android is:
      org.apache.harmony.nio.internal.SelectorImpl
      org.apache.harmony.nio.internal.SocketChannelImpl

      Fllowing James's instruction, i tried editing (DefaultConnectingIOReactor.java:97) by changing
      key = socketChannel.register(this.selector, 0);
      to
      key = socketChannel.register(this.selector, SelectionKey.OP_CONNECT);
      but this problem persists.

      After seaching web i fount this maybe can provide some help.
      http://lists.jboss.org/pipermail/netty-users/2009-January/000221.html

      1. HTTPCORE-226.patch
        2 kB
        Oleg Kalnichevski

        Activity

        Wang Yue created issue -
        Hide
        Oleg Kalnichevski added a comment -

        Wang,

        Could you please try out this patch by patching the last SVN snapshot and retesting your application?

        Even if the problem still persists, please post the exact stack trace

        http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk

        Oleg

        Show
        Oleg Kalnichevski added a comment - Wang, Could you please try out this patch by patching the last SVN snapshot and retesting your application? Even if the problem still persists, please post the exact stack trace http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk Oleg
        Oleg Kalnichevski made changes -
        Field Original Value New Value
        Attachment HTTPCORE-226.patch [ 12443276 ]
        Hide
        Wang Yue added a comment -

        retested by SVN codes(revision: 939650) after patched HTTPCORE-226.patch, the stack trace is:

        04-30 12:09:33.213: WARN/System.err(287): org.apache.http.nio.reactor.IOReactorException: I/O dispatch worker terminated abnormally
        04-30 12:09:33.242: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:324)
        04-30 12:09:33.264: WARN/System.err(287): at io.DownloadClient.run(DownloadClient.java:168)
        04-30 12:09:33.272: WARN/System.err(287): at java.lang.Thread.run(Thread.java:1096)
        04-30 12:09:33.282: WARN/System.err(287): Caused by: java.nio.channels.IllegalSelectorException
        04-30 12:09:33.293: WARN/System.err(287): at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:158)
        04-30 12:09:33.303: WARN/System.err(287): at java.nio.channels.SelectableChannel.register(SelectableChannel.java:158)
        04-30 12:09:33.323: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractIOReactor.processNewChannels(AbstractIOReactor.java:367)
        04-30 12:09:33.333: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:286)
        04-30 12:09:33.342: WARN/System.err(287): at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
        04-30 12:09:33.375: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:535)
        04-30 12:09:33.375: WARN/System.err(287): ... 1 more

        Show
        Wang Yue added a comment - retested by SVN codes(revision: 939650) after patched HTTPCORE-226 .patch, the stack trace is: 04-30 12:09:33.213: WARN/System.err(287): org.apache.http.nio.reactor.IOReactorException: I/O dispatch worker terminated abnormally 04-30 12:09:33.242: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:324) 04-30 12:09:33.264: WARN/System.err(287): at io.DownloadClient.run(DownloadClient.java:168) 04-30 12:09:33.272: WARN/System.err(287): at java.lang.Thread.run(Thread.java:1096) 04-30 12:09:33.282: WARN/System.err(287): Caused by: java.nio.channels.IllegalSelectorException 04-30 12:09:33.293: WARN/System.err(287): at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:158) 04-30 12:09:33.303: WARN/System.err(287): at java.nio.channels.SelectableChannel.register(SelectableChannel.java:158) 04-30 12:09:33.323: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractIOReactor.processNewChannels(AbstractIOReactor.java:367) 04-30 12:09:33.333: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:286) 04-30 12:09:33.342: WARN/System.err(287): at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) 04-30 12:09:33.375: WARN/System.err(287): at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:535) 04-30 12:09:33.375: WARN/System.err(287): ... 1 more
        Hide
        Oleg Kalnichevski added a comment -

        Try this patch out.

        Anyways, this does look like a bug in Android. Anyways, channels with no I/O interest in are perfectly valid. Why should not it be possible to register a channel with no I/O interest?

        Oleg

        Show
        Oleg Kalnichevski added a comment - Try this patch out. Anyways, this does look like a bug in Android. Anyways, channels with no I/O interest in are perfectly valid. Why should not it be possible to register a channel with no I/O interest? Oleg
        Oleg Kalnichevski made changes -
        Attachment HTTPCORE-226.patch [ 12443287 ]
        Oleg Kalnichevski made changes -
        Attachment HTTPCORE-226.patch [ 12443276 ]
        Hide
        Oleg Kalnichevski added a comment -

        Patch committed to SVN trunk. Closing as FIXED

        Oleg

        Show
        Oleg Kalnichevski added a comment - Patch committed to SVN trunk. Closing as FIXED Oleg
        Oleg Kalnichevski made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 4.1 [ 12313548 ]
        Fix Version/s Future [ 12313122 ]
        Resolution Fixed [ 1 ]
        Oleg Kalnichevski made changes -
        Fix Version/s 4.1 [ 12313548 ]
        Fix Version/s 4.1-beta2 [ 12315267 ]
        Oleg Kalnichevski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Wang Yue
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development