CPU usage on connectionLost
Posted: 18 Sep 2013, 14:56
Hi,
I'm writing a client Android application and I'm having issues when the client gets an unexpected connection loss. A "New I/O client worker #?-?" thread enters some kind of infinite loop, CPU usage increases and the GC starts working heavily. When it disconnects, I want to be able to display a "connection lost" dialog and let the user choose, but the whole application slows down. It persists after the connection.
Right now when I get the CONNECTION_LOST event I display the popup and if the user accepts, I start to connect from the beginning (connect, login, join a room...). Am I missing anything or is it a bug?
So far I have the following stack traces of the mentioned thread and a screenshot of the method profiler showing the high activity if it helps. I have also found a similar problem in this forum: http://forums.smartfoxserver.com/viewto ... 22&t=14568.

Thanks.
I'm writing a client Android application and I'm having issues when the client gets an unexpected connection loss. A "New I/O client worker #?-?" thread enters some kind of infinite loop, CPU usage increases and the GC starts working heavily. When it disconnects, I want to be able to display a "connection lost" dialog and let the user choose, but the whole application slows down. It persists after the connection.
Right now when I get the CONNECTION_LOST event I display the popup and if the user accepts, I start to connect from the beginning (connect, login, join a room...). Am I missing anything or is it a bug?
So far I have the following stack traces of the mentioned thread and a screenshot of the method profiler showing the high activity if it helps. I have also found a similar problem in this forum: http://forums.smartfoxserver.com/viewto ... 22&t=14568.

Code: Select all
at libcore.io.Posix.poll(Native Method)
at libcore.io.BlockGuardOs.poll(BlockGuardOs.java:119)
at java.nio.SelectorImpl.selectInternal(SelectorImpl.java:179)
at java.nio.SelectorImpl.select(SelectorImpl.java:156)
at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:38)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:164)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Code: Select all
at java.util.HashMap$HashIterator.<init>(HashMap.java:790)
at java.util.HashMap$KeyIterator.<init>(HashMap.java:831)
at java.util.HashMap$KeyIterator.<init>(HashMap.java:831)
at java.util.HashMap.newKeyIterator(HashMap.java:907)
at java.util.HashMap$KeySet.iterator(HashMap.java:913)
at java.util.HashSet.iterator(HashSet.java:161)
at java.nio.SelectorImpl$UnaddableSet.iterator(SelectorImpl.java:365)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:275)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)

