[
https://issues.apache.org/jira/browse/DIRMINA-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17346880#comment-17346880
]
Emmanuel Lécharny commented on DIRMINA-1142:
--------------------------------------------
The {{ProtocolCodec}} is *not* intended to be thread safe.
Give me a bit of time to review your proposal.
FTR, I really never liked the current implementation. The fact that the
encoder/decoder is always shared with all the chain is problematic. OTOH, we
assume the protocol implementer is aware that those two classes have to be
thread safe (which makes it quite complicated when you have to deal with
fragmentation).
Instanciating the encoder/decoder for every new session would not necessarily
cost more, not would kill performances, and would guarantee the thread safety,
IMHO.
> Missing messages when sending asynchronously
> --------------------------------------------
>
> Key: DIRMINA-1142
> URL: https://issues.apache.org/jira/browse/DIRMINA-1142
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.3, 2.1.4
> Environment: Linux
> Reporter: Maxime Leur
> Assignee: Jonathan Valliere
> Priority: Critical
> Fix For: 2.1.5
>
> Attachments: ClientServerTest.java
>
>
> I found an issue on 2.1.x branch when a client is sending messages
> asynchronously.
> I create a simple client and a server with a simple
> ObjectSerializationCodecFactory.
> On a client, I send simple String messages (e.g. Message:1) inside a thread
> pool (size=2).
> Then I check:
> * On client, I check that I send all these messages and avoid duplicate.
> * On server, I check that I receive all these messages.
> If client send "1000" messages on thread pool with 2 threads, server will
> miss 11messages:
> {noformat}
> 12:24:59,573 INFO <main> missingMessageTest.begin with 1000 messages and 2
> threads
> 12:24:59,577 INFO <main> missingMessageTest.end
> 12:24:59,577 INFO <main> missingMessageTest.sleep... 1000
> 12:24:59,580 ERROR <NioProcessor-14> messageSent: message <Message:21>
> already sent
> 12:24:59,581 ERROR <NioProcessor-14> messageSent: message <Message:27>
> already sent
> 12:24:59,584 ERROR <NioProcessor-14> messageSent: message <Message:113>
> already sent
> 12:24:59,587 ERROR <NioProcessor-14> messageSent: message <Message:164>
> already sent
> 12:24:59,592 ERROR <NioProcessor-14> messageSent: message <Message:313>
> already sent
> 12:24:59,596 ERROR <NioProcessor-14> messageSent: message <Message:386>
> already sent
> 12:24:59,604 ERROR <NioProcessor-14> messageSent: message <Message:567>
> already sent
> 12:24:59,605 ERROR <NioProcessor-14> messageSent: message <Message:615>
> already sent
> 12:24:59,606 ERROR <NioProcessor-14> messageSent: message <Message:628>
> already sent
> 12:24:59,611 ERROR <NioProcessor-14> messageSent: message <Message:760>
> already sent
> 12:24:59,612 ERROR <NioProcessor-14> messageSent: message <Message:822>
> already sent
> 12:25:00,578 INFO <main> missingMessageTest.sleep... 2000
> 12:25:01,578 INFO <main> missingMessageTest.sleep... 3000
> 12:25:02,579 INFO <main> missingMessageTest.sleep... 4000
> 12:25:03,579 INFO <main> missingMessageTest.sleep... 5000
> 12:25:04,579 INFO <main> missingMessageTest.close
> 12:25:04,582 ERROR <main> missing <11> messages : [Message:760, Message:27,
> Message:21, Message:313, Message:567, Message:822, Message:615, Message:628,
> Message:386, Message:113, Message:164]
> {noformat}
> I works fine with one thread (e.g. synchronous send).
> This junit works with "Apache Mina" "2.0.21", it failed with "2.1.x" branch.
> I attach my junit to reproduce this issue on your side.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]