Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4529733

(so) Accept wakes up on uninteresting operations (solaris/iMQ)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • sparc
    • solaris_7

      This bug is related to:
         workaround for:
            > 4528477 (ch) System spins when interestOps(int) invoked (solaris)
          and
              4529728: solaris: accept doesnt wake up w/ PollProvider and interestOps


      I'm still looking for workarounds to this problem -> If I find one I will
      update the workaround and downgrade the bug

      Bug Descrition:
        I have a Server which waits for clients which are active on a selector
        and then assigns them to a worker thread
        Once the thread is assigned, the interestOps are updated to stop
        looking at the assigned channels (until processing is complete)
            - this should prevent 2 threads from processing the same channel
         Once processing is complete, the assigned thread updates the interestOps
         (to reprocess any events)
         Also the assigned thread handles turning on and off the write interest
         op depending on whether messages are waiting to be writting to the
         client.

      After a few changes of interest, the server comes out of select on operations
      which are not in the list of interestOps

      To duplicate:
         Untar and compile the classes, there are 5 java files:
             Runner.java -> the runnable for the thread pool
            ThreadPool.java -> a simple thread pool which contains the
                  "unbusy" threads
             Process -> the task that gets run on a thread, this handles
                  reading, writing data
            Server -> the server process which handles watching the selector
                      for active channels
            Client -> a simple client program which sends data (with periodic
                      waits to insure that the socket is not continually busy)

         Start the server:
             java -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider Server

          Start the client:
              java Client

      After a few seconds, the server should fail with something that looks like:

      java -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider Server
      ready to accept connections
      Active keys [1]
      Active keys [1]
      assigning [Process@723d7c] to a thread Runner@22c95b
      key doesnt match ready ops
      Active keys [1]
      assigning [Process@723d7c] to a thread Runner@d1acd3
      key doesnt match ready ops
      Active keys [1]
      assigning [Process@723d7c] to a thread Runner@a981ca
      key doesnt match ready ops
      Active keys [1]
      assigning [Process@723d7c] to a thread Runner@8814e9
      key doesnt match ready ops
      Active keys [1]
      assigning [Process@723d7c] to a thread Runner@1503a3
      key doesnt match ready ops
      Active keys [1]
      assigning [Process@723d7c] to a thread Runner@a1c887
      key doesnt match ready ops
      Failed 6 times in a row

      [attaching test case, I couldnt attach it in the red.iplanet domain]

            mmcclosksunw Michael Mccloskey (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: