You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2008/04/20 07:58:22 UTC

[jira] Created: (DIRMINA-574) ClassCastException when a message is written on a closed session.

ClassCastException when a message is written on a closed session.
-----------------------------------------------------------------

                 Key: DIRMINA-574
                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
             Project: MINA
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.0-M1
            Reporter: Trustin Lee
            Priority: Minor
             Fix For: 1.0.10, 1.1.7


Steps to reproduce:
1) Connection is closed at the socket level.
2) A user writes a message.
3) the message is encoded by a ProtocolCodecFilter.
4) MINA notices the closed socket and fires a sessionClosed event.
5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.

A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.

The following is the stack trace that explains this scenario:

25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> java.lang.ClassCastException:
> org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> incompatible with com.daishin.eai.adapter.socket.message.Por
> tMessage
>         at
> com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
>         at
> org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
>         at
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
>         at
> org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
>         at
> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
>         at
> org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
>         at
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
>         at
> org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
>         at
> org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
>         at
> org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
>         at
> org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
>         at
> org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
>         at
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
>         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trustin Lee updated DIRMINA-574:
--------------------------------

    Affects Version/s: 1.1.7
                       1.0.10
        Fix Version/s:     (was: 1.1.7)
                           (was: 1.0.10)

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M1, 1.0.10, 1.1.7
>            Reporter: Trustin Lee
>            Priority: Minor
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638840#action_12638840 ] 

Emmanuel Lecharny commented on DIRMINA-574:
-------------------------------------------

The Worker does not check if the Selected key is valid or not. In this case, if the connection has been closed, the SelectedKey will be invalid, thus should not be processed. As it's not checked, it is processed, leading to the problem.

We should always check if the selected key is valid _before_ doing any kind of processing, but that mean a deep refactoring of the selectedHandles() method. 

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.10, 1.1.7, 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M4
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-574:
--------------------------------------

    Priority: Blocker  (was: Minor)

raised to blocker, as the underlaying logic used to handle selected keys is flawed.

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.10, 1.1.7, 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Blocker
>             Fix For: 2.0.0-M4
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646418#action_12646418 ] 

Emmanuel Lecharny commented on DIRMINA-574:
-------------------------------------------

The best way to fix this issue is to avoid emitting this totally useless MessageSent event. I don't know why it has been created, but in any case, it will be a relief to get rid of it, as it generates problems and does not help at all...

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.10, 1.1.7, 2.0.0-M1
>            Reporter: Trustin Lee
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 2.0.0-M4
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny reassigned DIRMINA-574:
-----------------------------------------

    Assignee: Emmanuel Lecharny

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.10, 1.1.7, 2.0.0-M1
>            Reporter: Trustin Lee
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 2.0.0-M4
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Julien Vermillard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julien Vermillard updated DIRMINA-574:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-M3)
                       (was: 1.1.8)
                       (was: 1.0.11)
                   2.0.0-M4

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.10, 1.1.7, 2.0.0-M1
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M4
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Julien Vermillard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julien Vermillard updated DIRMINA-574:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-M2)
                   2.0.0-M3

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M1, 1.0.10, 1.1.7
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M3, 1.0.11, 1.1.8
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trustin Lee updated DIRMINA-574:
--------------------------------

    Fix Version/s: 1.1.8
                   1.0.11
                   2.0.0-M2

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M1, 1.0.10, 1.1.7
>            Reporter: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M2, 1.0.11, 1.1.8
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-574) ClassCastException when a message is written on a closed session.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-574:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-M4)
                   3.0.0-M1

Will be fixed when the MessageSent message will be removed, something that can't be done for 2.0

> ClassCastException when a message is written on a closed session.
> -----------------------------------------------------------------
>
>                 Key: DIRMINA-574
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-574
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.10, 1.1.7, 2.0.0-M1
>            Reporter: Trustin Lee
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 3.0.0-M1
>
>
> Steps to reproduce:
> 1) Connection is closed at the socket level.
> 2) A user writes a message.
> 3) the message is encoded by a ProtocolCodecFilter.
> 4) MINA notices the closed socket and fires a sessionClosed event.
> 5) After the sessionClosed event is fired, IoFilterChain.clear() is called.
> 6) MINA tries to write the user write request, but the session is closed already - all write requests are discarded.
> 7) Before MINA discards all write requests, MINA checks if the first item in the queue is an empty buffer, which means a special separator which is handled by ProtocolCodecFilter.
> 8) If there's an empty buffer in the head of the queue, MINA fires a messageSent event with the empty buffer in the hope that ProtocolCodecFilter will catch it.
> 9) However, the filter chain is empty and therefore IoHandler implementation gets ClassCastException.
> A possible workaround is just to ignore the exception, but we need to provide a correct fix for this issue.
> The following is the stack trace that explains this scenario:
> 25151 [SocketAcceptorIoProcessor-0.4] WARN  ServerPortSessionHandler  -
> > [/127.0.0.1:57120 <http://127.0.0.1:57120>]
> > java.lang.ClassCastException:
> > org.apache.mina.filter.codec.ProtocolCodecFilter$MessageByteBuffer
> > incompatible with com.daishin.eai.adapter.socket.message.Por
> > tMessage
> >         at
> > com.daishin.eai.adapter.socket.handler.ServerPortSessionHandler.messageSent(ServerPortSessionHandler.java:80)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageSent(AbstractIoFilterChain.java:579)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:53)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageSent(AbstractIoFilterChain.java:653)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageSent(AbstractIoFilterChain.java:504)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageSent(AbstractIoFilterChain.java:320)
> >         at
> > org.apache.mina.common.support.AbstractIoFilterChain.fireMessageSent(AbstractIoFilterChain.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.releaseWriteBuffers(SocketIoProcessor.java:359)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcessor.java:314)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:45)
> >         at
> > org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:488)
> >         at
> > org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> >         at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> >         at java.lang.Thread.run(Thread.java:810)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.