Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-810

DIRMINA-803 ProtocolCodecFilter.filterWrite() is no longer thread-safe not fixed totally

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0.0, 2.0.1
    • 2.0.2
    • Filter
    • None

    Description

      Hi,I notice DIRMINA-803 https://issues.apache.org/jira/browse/DIRMINA-803 sayed ProtocolEncoderOutputImpl.flush(). also has same question as ProtocolCodecFilter.filterWrite().
      I checked the source at http://svn.apache.org/viewvc?view=revision&revision=1023759
      found two places line 427 and line 452 also has same question
      423 public void flush(NextFilter nextFilter, IoSession session) {
      424 Queue<Object> messageQueue = getMessageQueue();
      425
      426 while (!messageQueue.isEmpty())

      { 427 nextFilter.messageReceived(session, messageQueue.poll()); 428 }

      from 426 may should as follows
      while (!messageQueue.isEmpty()) {
      Object encodedMessage = messageQueue.poll();
      if (encodedMessage == null)

      { break; }

      nextFilter.messageReceived(session, encodedMessage.poll());
      }

      and
      451 while (!bufferQueue.isEmpty()) {
      452 Object encodedMessage = bufferQueue.poll();
      453
      454 // Flush only when the buffer has remaining.
      455 if (!(encodedMessage instanceof IoBuffer) || ((IoBuffer) encodedMessage).hasRemaining()) {

      at line 453 should insert
      if (encodedMessage == null)

      { break; }

      Attachments

        Activity

          People

            elecharny Emmanuel Lécharny
            charley charley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: