Details
Description
With multiple threads that write messages to a mina session.
Sometimes i have this exception trace:
org.apache.mina.filter.codec.ProtocolEncoderException: java.lang.IllegalArgumentException: message
at org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:339)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:482)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:775)
at org.apache.mina.filter.executor.ExecutorFilter.filterWrite(ExecutorFilter.java:614)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:482)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:775)
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:84)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.IllegalArgumentException: message
at org.apache.mina.core.write.DefaultWriteRequest.<init>(DefaultWriteRequest.java:133)
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolEncoderOutputImpl.flush(ProtocolCodecFilter.java:448)
I've mad some debug on mina source code and i've found that in ProtocolCodecFilter ther's this code at line: 446:
if (future == null) {
// Creates an empty writeRequest containing the destination
WriteRequest writeRequest = new DefaultWriteRequest(null, null, destination);
But this method doesn't work because seeing DefaultWriteRequest constructor ther's this code:
public DefaultWriteRequest(Object message, WriteFuture future, SocketAddress destination) {
if (message == null)
Should be a bug.
In my case i have this exception but i don't have some real problem. I think that many flush on same session 'steal' messages to write on flush each other.
I don't have application problem. The messages seem to arrive at client side, but i have some stack trace exception and after session close i've seen from jmx that there are some statistics.writeScheduledMessages with none sessions active.
Attachments
Issue Links
- duplicates
-
DIRMINA-982 ProtocolEncoderOutputImpl.flush() throws an IllegalArgumentException if buffers queue is empty
- Resolved