You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2016/02/01 00:29:39 UTC

[jira] [Updated] (DIRMINA-1025) A call to session.closed(true) may still flush messages.

     [ https://issues.apache.org/jira/browse/DIRMINA-1025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-1025:
---------------------------------------
    Summary: A call to session.closed(true) may still flush messages.  (was: A call to session.closed(true) will still flush messages.)

> A call to session.closed(true) may still flush messages.
> --------------------------------------------------------
>
>                 Key: DIRMINA-1025
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1025
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.11
>            Reporter: Emmanuel Lecharny
>
> 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 :
> {noformat}
>     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);
>             }
>         }
>     }
> {noformat}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)