Hi guys,
I tried to update my RMI replacement library "SIMON"
(http://dev.root1.de/projects/show/simon) from MINA 2.0.0-M6 to 2.0.0.
On the first look, all worked. But as soon as I run my Junit-Tests, I get
the following Exception in the log:
----
org.apache.mina.filter.codec.ProtocolEncoderException:
java.lang.IllegalArgumentException: message
at
org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:351)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:509)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:46)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:808)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:734)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:509)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:501)
at
org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:450)
at
org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:391)
at
de.root1.simon.ProcessMessageRunnable.processNameLookup(ProcessMessageRunnable.java:303)
at
de.root1.simon.ProcessMessageRunnable.run(ProcessMessageRunnable.java:86)
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: java.lang.IllegalArgumentException: message
at
org.apache.mina.core.write.DefaultWriteRequest.<init>(DefaultWriteRequest.java:135)
at
org.apache.mina.filter.codec.ProtocolCodecFilter$EncodedWriteRequest.<init>(ProtocolCodecFilter.java:389)
at
org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:334)
... 13 more
----
Some details:
The test starts a MINA server, and start about 100 threads with a MINA
client (all wrapped by my SIMON library). Each thread/client writes and
reads several messages.
The more threads/clients I use, the bigger is the change to get this
exception. On my machine (4x2,8Ghz Win7 64bit + 32bit JVM), it's
reproducible with at least >=22 threads. With 100 threads is quite easy.
I debugged the issue and found out, that the exceptions tries to explain,
that the "message" is null (another question: why isn't it saying: "message
must NOT be null?" instead of "message" ???? Without debugging and having
deeper MINA knowledge, noone knows what goes wrong).
I tried to ensure that my protocol-code is "null-safe" and that each
message IS NOT null. Beside that: It's not only one thread/client
complaining about this issue. There are a lot. And it's *always* while
sending the first message after the connection has been established.
As this issue is only visible when running a lot of concurrent clients,
sending and receiving messages ...
Is this already known?
Can someone give me a hint how to further digg into to find the
root-cause?
It's not easy to write a reproduce-sample. But if you want, you can
1) checkout http://svn.root1.de/svn/simon/trunk/
2) change the dependency in pom.xml from 2.0.0-M6 to 2.0.0
3) run the
"http://svn.root1.de/svn/simon/trunk/src/test/java/de/root1/simon/test/TestThreadedLookup.java"
Junit-test and watch the console output
best regards,
Alex