[
https://issues.apache.org/jira/browse/DIRMINA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659376#action_12659376
]
Mauritz Lovgren commented on DIRMINA-653:
-----------------------------------------
No, no executor filter, only a protocol codec filter and an IoHandler.
As far as I can see, one explanation can be that the session.write has no
protection for simultaneous update of the ProtocolEncoderOutputImpl
(ENCODER_OUT) property. If multiple threads call write simultaneously, the
property (holding the currently message to write) will suffer a race on update
which might prevent messages from being written to the write queue.
I might be wrong here, but I find no other simple explanation.
Another curiosity is that should the message fail to be added to the write
queue, no error is generated (the offer() method to the CyclicQueue could
return false, which is just ignored).
> IoSession.write not thread-safe? Loosing messages under heavy multi-threaded
> write on same session.
> ---------------------------------------------------------------------------------------------------
>
> Key: DIRMINA-653
> URL: https://issues.apache.org/jira/browse/DIRMINA-653
> Project: MINA
> Issue Type: Bug
> Components: Core, Filter
> Affects Versions: 2.0.0-M4
> Environment: Windows Vista 64-bit
> Reporter: Mauritz Lovgren
>
> I am writing a stress-test that tests multi-thread safetyness of our
> stateless encoder / decoder under heavy load and I am observing that messages
> are silently lost during session.write(Object), (the lost messages do not
> seem to reach the underlying socket buffer at all).
> I am using one encoder / decoder that is stateless. No executor filter, only
> the filter codec and a basic io handler.
> Synchronizing on the session.write makes the problem go away;
> synchronized (session)
> {
> future = session.write(message);
> }
> Do I really have to synchronize on the session to solve this issue?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.