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

A call to session.closed(true) may still flush messages.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.11
    • Fix Version/s: 2.0.14
    • Component/s: Core
    • Labels:
      None

      Description

      If we call for a session.close(true), we expect the session not to write any messages into the socket.

      This is not what happen. The close(true) call just adds the session into the IoProcessor.removedSession queue, and continue to proceed with flush before processing the session removal.

      Typically, if the session is being closed in a IoHandler.messageReceived(), then it comes form the process() method call, which is :

          private void process(S session) {
              // Process Reads
              if (isReadable(session) && !session.isReadSuspended()) {
                  read(session);
              }
      
              // Process writes
              if (isWritable(session) && !session.isWriteSuspended()) {
                  // add the session to the queue, if it's not already there
                  if (session.setScheduledForFlush(true)) {
                      flushingSessions.add(session);
                  }
              }
          }
      

      At this point, after the read, the write may be executed (typically if some big message was written but not sent completely, so that the OP_WRITE flag was set to TRUE).

      We should most certainly check if the session is being closed before trying to write something.

        Activity

        Hide
        elecharny Emmanuel Lecharny added a comment -

        Definitively something that has to be fixed.

        Show
        elecharny Emmanuel Lecharny added a comment - Definitively something that has to be fixed.
        Hide
        elecharny Emmanuel Lecharny added a comment -

        This should have been fixed with DIRMINA-1021

        Show
        elecharny Emmanuel Lecharny added a comment - This should have been fixed with DIRMINA-1021

          People

          • Assignee:
            Unassigned
            Reporter:
            elecharny Emmanuel Lecharny
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development