mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Schwarz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRMINA-653) IoSession.write not thread-safe? Loosing messages under heavy multi-threaded write on same session.
Date Fri, 15 Apr 2011 14:37:06 GMT

    [ https://issues.apache.org/jira/browse/DIRMINA-653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020311#comment-13020311
] 

Christian Schwarz commented on DIRMINA-653:
-------------------------------------------

It took the whole week to reproduce it, but finally we have once again! After some time we
get an Exception from the SerialisationDecoder, it seem that at a specific point the SerialisationDecoder
get malicious data of the CompressionDecoder.

org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.mina.core.buffer.BufferDataException:
java.io.StreamCorruptedException: invalid type code: 02 (Hexdump: 00 00 02 C8 AC ED 00 05
73 72 01 00 2B 65 75 2E 67 65 6D 74 65 63 2E 77 6F 74 61 6E 2E 63 6F 6D 6D 73 65 72 76 69
63 65 2E 6D 65 73 73 61 67 65 2E 4D 65 73 73 61 67 65 78 70 00 00 03 13 73 72 01 00 3C 63
6F 6D 2E 69 78 65 6C 6C 65 6E 63 65 2E 66 6D 73 2E 64 61 74 61 6D 6F 64 65 6C 2E 63 6F 6D
6D 2E 64 61 74 61 6D 6F 64 65 6C 2E 44 61 74 61 4D 6F 64 65 6C 43 6F 6E 74 65 6E 74 73 78
70 75 72 01 00 2D 5B 4C 63 6F 6D 2E 69 78 65 6C 6C 65 6E 63 65 2E 66 6D 73 2E 63 6F 6D 6D
6F 6E 73 2E 64 61 74 61 6D 6F 64 65 6C 2E 49 53 74 61 74 65 3B 78 70 00 00 00 01 73 72 01
00 2E 63 6F 6D 2E 69 78 65 6C 6C 65 6E 63 65 2E 66 6D 73 2E 63 6F 6D 6D 6F 6E 73 2E 64 61
74 61 6D 6F 64 65 6C 2E 69 6D 70 6C 2E 53 74 61 74 65 78 72 01 00 34 63 6F 6D 2E 69 78 65
6C 6C 65 6E 63 65 2E 66 6D 73 2E 63 6F 6D 6D 6F 6E 73 2E 64 61 74 61 6D 6F 64 65 6C 2E 69
6D 70 6C 2E 42 61 73 65 45 6C 65 6D 65 6E 74 78 70 74 00 06 53 49 4C 45 4E 54 74 00 04 52
75 68 65 70 70 70 74 00 10 73 74 61 74 65 5F 6E 6F 72 6D 61 6C 2E 67 69 66 70 77 04 00 00
00 00 78 7E 72 01 00 3D 63 6F 6D 2E 69 78 65 6C 6C 65 6E 63 65 2E 66 6D 73 2E 64 61 74 61
6D 6F 64 65 6C 2E 63 6F 6D 6D 2E 64 61 74 61 6D 6F 64 65 6C 2E 53 65 72 76 69 63 65 52 65
71 75 65 73 74 54 79 70 65 78 72 01 00 0E 6A 61 76 61 2E 6C 61 6E 67 2E 45 6E 75 6D 78 70
74 00 15 41 32 4D 5F 45 56 54 5F 53 54 41 54 45 5F 43 48 41 4E 47 45 44 73 72 01 00 37 6F
72 67 2E 74 69 73 65 2E 77 6F 74 61 6E 2E 63 6F 6D 6D 6F 6E 73 2E 64 61 74 61 6D 6F 64 65
6C 2E 69 6D 70 6C 2E 45 6C 65 6D 65 6E 74 49 64 65 6E 74 69 66 69 65 72 02 FB AC ED 00 05
73 72 01 00 2B 65 75 2E 67 6C 2E 4C 69 6E 6B 65 64 4C 69 73 74 78 70 77 04 00 00 00 04 74
00 04 72 6F 6F 74 74 00 02 23 31 74 00 0C 64 75 6D 6D 79 20 72 6F 6F 74 3A 31 74 00 01 31
78 74 00 40 63 6F 6D 2E 69 78 65 6C 6C 65 6E 63 65 2E 66 6D 73 2E 64 61 74 61 6D 6F 64 65
6C 2E 63 6F 6D 6D 2E 6D 61 6E 61 67 65 72 2E 4D 61 6E 61 67 65 72 44 61 74 61 6D 6F 64 65
6C 53 65 72 76 69 63 65 7E 72 01 00 30 65 75 2E 67 65 6D 74 65 63 2E 77 6F 74 61 6E 2E 63
6F 6D 6D 73 65 72 76 69 63 65 2E 6D 65 73 73 61 67 65 2E 4D 65 73 73 61 67 65 24 54 79 70
65 78 71 00 7E 00 0D 74 00 08 49 4E 46 4F 5F 4D 53 47)
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:251)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$5(DefaultIoFilterChain.java:429)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.filter.compression.CompressionFilter.messageReceived(CompressionFilter.java:157)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$5(DefaultIoFilterChain.java:429)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:693)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:646)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:635)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$7(AbstractPollingIoProcessor.java:632)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1079)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.mina.core.buffer.BufferDataException: java.io.StreamCorruptedException:
invalid type code: 02
	at org.apache.mina.core.buffer.AbstractIoBuffer.getObject(AbstractIoBuffer.java:1984)
	at org.apache.mina.filter.codec.serialization.ObjectSerializationDecoder.doDecode(ObjectSerializationDecoder.java:92)
	at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:178)
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:241)
	... 19 more

________________________________________________________________________________________________________________


org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.mina.core.buffer.BufferDataException:
dataLength: 1684108439 (Hexdump: 64 61 74 97 AC ED 00 05 73 72 01 00 2B 65 75 2E 67 65 6D
74 65 63 2E 77 6F 74 61 6E 2E 63 6F 6D 6D 73 65 72 76 69 63 65 2E 6D 65 73 73 61 67 65 2E
4D 65 73 73 61 67 65 78 70 00 00 03 41 70 70 67 65 72 44 61 74 61 6D 6F 64 65 6C 53 65 72
76 69 63 65 7E 72 01 00 30 65 75 2E 67 65 6D 74 65 63 2E 77 6F 74 61 6E 2E 63 6F 6D 6D 73
65 72 76 69 63 65 2E 6D 65 73 73 61 67 65 2E 4D 65 73 73 61 67 65 24 54 79 70 65 78 71 00
7E 0E 4B 45 45 50 5F 41 4C 49 56 4F 5F 4D 53 47)
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:251)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$5(DefaultIoFilterChain.java:429)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.filter.compression.CompressionFilter.messageReceived(CompressionFilter.java:157)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$5(DefaultIoFilterChain.java:429)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
	at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
	at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:693)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:646)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:635)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$7(AbstractPollingIoProcessor.java:632)
	at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1079)
	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.mina.core.buffer.BufferDataException: dataLength: 1684108439
	at org.apache.mina.core.buffer.AbstractIoBuffer.prefixedDataAvailable(AbstractIoBuffer.java:2058)
	at org.apache.mina.filter.codec.serialization.ObjectSerializationDecoder.doDecode(ObjectSerializationDecoder.java:88)
	at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:178)
	at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:241)
	... 19 more



> 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
>             Fix For: 2.0.0-M5
>
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message