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

(so) Accept blocks even when socket is ready (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)
         a similar bug with the PollProvider (4529733)


      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 no longer comes out of select
      on the interest ops (even through the socket is "ready")

      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

           and Wait for the timeout to wakup atleast once (you will see --wakeup--)

          Start the client:
              java Client

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

      -- wakeup --
      ------------------
              key ops accept write read
              sun.nio.ch.SelectionKeyImpl@dd20f6 5 false true false
              sun.nio.ch.SelectionKeyImpl@9189e1 16 true false false
      ERROR: selector is not waking up

      NOTE: I have had a few times where the error did not immediately occur, and
       the system displayed a different error about threads -> the thread error
       is really a bug in the server (caused because of the order I set the ops
        in) I've seen the error in other cases (when I set the ops differently)
        but this seemed to be the more reproducable

      -----------
      attaching test case [ I could not attach the test 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: