Hi,
I'm having a strange issue with IoSession's write(Object msg)
blocking for an indeterminate time, on random occasions. Equally
puzzling is that in most cases if I wait long enough, it'll
finish in about 100x the time it normally takes.
This is reproduceable about 50% of the time when I run my client
app on a winxp javavm (latest 6u11), but it never happens if I
run the client on the linux server. It could be OS related, or it
could just be that I'm running it remotely in one case and not
the other. They are connected on a very fast LAN so it's not a
simple lag issue (I hope).
All I'm doing is sending about 3000 very small packets through a
slightly modified version of the chatserver/client sample, with
just 1 client. There's VERY little data per message, but they are
sent almost one after the other. The writes are performed
directly on the session while inside IoHandlerAdapter's
messageReceived() --- is that bad? Should I not use the session
object for writing while in the receive handler? It seems to work
fine when I run it in linux.
I've attached the full stack trace...
2008-12-16 04:17:27
Full thread dump Java HotSpot(TM) Client VM (11.0-b16 mixed mode, sharing):
"DestroyJavaVM" prio=6 tid=0x003b6800 nid=0xf20 waiting on condition
[0x00000000..0x009efd4c]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"NioProcessor-1" prio=6 tid=0x02f0ac00 nid=0x7d8 runnable
[0x0326f000..0x0326fd14]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
- locked <0x22ef6700> (a sun.nio.ch.Util$1)
- locked <0x22ef66f0> (a java.util.Collections$UnmodifiableSet)
- locked <0x22ef59a8> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(Unknown Source)
at
org.apache.mina.transport.socket.nio.NioProcessor.select(NioProcessor.java:69)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:861)
at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- <0x22f05da0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
"Low Memory Detector" daemon prio=6 tid=0x02b91400 nid=0x810 runnable
[0x00000000..0x00000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"CompilerThread0" daemon prio=10 tid=0x02b8e800 nid=0xc94 waiting on condition
[0x00000000..0x02e3f740]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Attach Listener" daemon prio=10 tid=0x02b89800 nid=0x7f0 waiting on condition
[0x00000000..0x00000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Signal Dispatcher" daemon prio=10 tid=0x02b88800 nid=0xa8 runnable
[0x00000000..0x00000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Finalizer" daemon prio=8 tid=0x02b80400 nid=0x5ec in Object.wait()
[0x02d4f000..0x02d4fc94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x22ee35e8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <0x22ee35e8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
Locked ownable synchronizers:
- None
"Reference Handler" daemon prio=10 tid=0x02b7ec00 nid=0xfdc in Object.wait()
[0x02cff000..0x02cffd14]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x22ee3670> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:485)
at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
- locked <0x22ee3670> (a java.lang.ref.Reference$Lock)
Locked ownable synchronizers:
- None
"VM Thread" prio=10 tid=0x02b7d400 nid=0xe10 runnable
"VM Periodic Task Thread" prio=10 tid=0x02b93400 nid=0x910 waiting on condition
JNI global references: 1018