MINA
  1. MINA
  2. DIRMINA-830

Unconditional wait() in Read- and WriteWorker of SerialSessionImpl

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.0.1, 2.0.2
    • Fix Version/s: 2.0.4
    • Component/s: Transport
    • Labels:
    • Environment:
      win32 x86

      Description

      The inner worker classes of SerialSessionImpl violates the guarded block contract for Object#wait(). Under certain conditions it is possible that a session write starved.

      The wait loops of Read- and WriteWorker should be inside the synchronized block! We have some starvations while writing data to or serial session. We found out that in this case the WriteWorker-Thread waits endless for data to write. Because we write data asynchron to the serial session, we assume that a race condition occures. One thread is inside the unguarded WriterWorker#flushWrites() while an other invoke SerialProcessor#flush().

      http://download.oracle.com/javase/tutorial/essential/concurrency/guardmeth.html
      states-> Always invoke wait inside a loop that tests for the condition being waited for. Don't assume that the interrupt was for the particular condition you were waiting for, or that the condition is still true.

      1. patch.diff
        1 kB
        Julien Vermillard

        Activity

          People

          • Assignee:
            Julien Vermillard
            Reporter:
            Christian Schwarz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development