Uploaded image for project: 'Apache AWF'
  1. Apache AWF
  2. AWF-182

Close channel if we (during read) reach EOF and there is nothing to write

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Labels:
      None

      Description

      Proposal: In AS.handleRead(..) add
      if (read == -1) { // EOF
      reachedEOF = true;
      ioLoop.updateHandler(channel, interestOps &= ~SelectionKey.OP_READ);
      if (writeBuffer.position() == 0)

      { invokeCloseCallback(); }

      return;
      }

      (the invokeCloseCallback() + surronding if statement is new)

      Found this issue during DEFT-151 (disitributed demo application).

      The problem is that its easy to leak connection if we dont handle this case. The problem is that you never will get a notification/callback that the client/server is down (if you only are reading from the asynchronous socket, as soon as you try to write to the socket, you will get a close callback....but that is only if you acctually try to write on the socket).

        Attachments

        1. deft-170.patch
          0.7 kB
          umesh awasthi

          Activity

            People

            • Assignee:
              jmeehan Johnathan Meehan
              Reporter:
              rschildmeijer Roger Schildmeijer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: