Hi Trustin Here is the full thread dump. I've now split the ioSession.close().join(); into CloseFuture cf = ioSession.close(); cf.join();
Note that I've setup a debug point using Eclipse just before the ioSession.close() occurs and at that stage I can still access the socket server (using a browser and pointing it at http://192.168.20.50:20700/) As soon as I step over the ioSession.close() the socket server doesn't respond anymore... As far as I can tell it gets stuck in the lock.wait() of the IoFuture because it's not ready. /** * Wait for the asynchronous operation to end. */ public void join() { synchronized( lock ) { while( !ready ) { try { lock.wait(); } catch( InterruptedException e ) { } } } } I can provide more details so let me know. On Wed, 2006-08-09 at 16:41 +0900, Trustin Lee wrote: > On 8/9/06, Frederic Soulier <[EMAIL PROTECTED]> wrote: > > > > When a mobile phone is used as a client and is connected to the > > SocketAcceptor on the server we can send some messages and all seems > > fine. > > If the battery of the phone is removed (hence terminating the client > > application), we have a process that scans for sessions without activity > > for more than 30 seconds. If such a session is found we call: > > ioSession.close().join(); > > > > At that point the socketAcceptor doesn't accept any connections at all. > > Our only way to get it back is to kill it and restart it. > > > This is weird because SocketAcceptor thread doesn't take care of closing a > session. SocketIoProcessor does it instead. That is, SocketAcceptor thread > shouldn't get affected by any I/O after acceptance of a channel. Could you > post a full thread dump for us? Full thread dump Java HotSpot(TM) Server VM (1.5.0_07-b03 mixed mode): "PooledByteBufferExpirer-0" daemon prio=1 tid=0x08dfa180 nid=0xa90 waiting on condition [0x8b479000..0x8b479fc0] at java.lang.Thread.sleep(Native Method) at org.apache.mina.common.PooledByteBufferAllocator $Expirer.run(PooledByteBufferAllocator.java:289) "AnonymousIoService-2-2" daemon prio=1 tid=0x08b5a780 nid=0xa8f in Object.wait() [0x8b4fa000..0x8b4fb040] at java.lang.Object.wait(Native Method) - waiting on <0xae623b98> (a org.apache.mina.util.BlockingQueue) at java.lang.Object.wait(Object.java:474) at org.apache.mina.util.BlockingQueue.waitForNewItem(BlockingQueue.java:55) - locked <0xae623b98> (a org.apache.mina.util.BlockingQueue) at org.apache.mina.filter.ThreadPoolFilter $Worker.fetchBuffer(ThreadPoolFilter.java:447) - locked <0xae623b98> (a org.apache.mina.util.BlockingQueue) at org.apache.mina.filter.ThreadPoolFilter $Worker.run(ThreadPoolFilter.java:422) "SocketAcceptorIoProcessor-0.0" prio=1 tid=0x08b5b808 nid=0xa8c runnable [0x8b57b000..0x8b57c0c0] at sun.nio.ch.FileDispatcher.preClose0(Native Method) at sun.nio.ch.SocketDispatcher.preClose(SocketDispatcher.java:41) at sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(SocketChannelImpl.java:626) - locked <0xae6b1418> (a java.lang.Object) at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(AbstractSelectableChannel.java:201) at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:97) - locked <0xae6b13f0> (a java.lang.Object) at org.apache.mina.transport.socket.nio.SocketIoProcessor.doRemove(SocketIoProcessor.java:217) at org.apache.mina.transport.socket.nio.SocketIoProcessor.access $600(SocketIoProcessor.java:41) at org.apache.mina.transport.socket.nio.SocketIoProcessor $Worker.run(SocketIoProcessor.java:569) "AnonymousIoService-2-1" daemon prio=1 tid=0x08b5b330 nid=0xa8b in Object.wait() [0x8b5fc000..0x8b5fd140] at java.lang.Object.wait(Native Method) - waiting on <0xae6f2a48> (a java.lang.Object) at org.apache.mina.filter.ThreadPoolFilter $Worker.waitForPromotion(ThreadPoolFilter.java:546) - locked <0xae6f2a48> (a java.lang.Object) at org.apache.mina.filter.ThreadPoolFilter $Worker.run(ThreadPoolFilter.java:419) "DestroyJavaVM" prio=1 tid=0x086293d0 nid=0xa64 waiting on condition [0x00000000..0xbf831bb0] "SocketAcceptor-1" prio=1 tid=0x089bb9f0 nid=0xa85 runnable [0x8b67d000..0x8b67e1c0] at sun.nio.ch.PollArrayWrapper.poll0(Native Method) at sun.nio.ch.PollArrayWrapper.poll(PollArrayWrapper.java:100) at sun.nio.ch.PollSelectorImpl.doSelect(PollSelectorImpl.java:56) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69) - locked <0xae676e58> (a sun.nio.ch.Util$1) - locked <0xae676e48> (a java.util.Collections$UnmodifiableSet) - locked <0xae676c50> (a sun.nio.ch.PollSelectorImpl) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:84) at org.apache.mina.transport.socket.nio.SocketAcceptor $Worker.run(SocketAcceptor.java:355) "Timer-1" prio=1 tid=0x08dfc528 nid=0xa84 in Object.wait() [0x8b6fe000..0x8b6fee40] at java.lang.Object.wait(Native Method) - waiting on <0xae6766c0> (a java.util.TaskQueue) at java.lang.Object.wait(Object.java:474) at java.util.TimerThread.mainLoop(Timer.java:483) - locked <0xae6766c0> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:462) "SocketAcceptor-0" prio=1 tid=0x0902ac68 nid=0xa83 runnable [0x8b8fe000..0x8b8feec0] at sun.nio.ch.PollArrayWrapper.poll0(Native Method) at sun.nio.ch.PollArrayWrapper.poll(PollArrayWrapper.java:100) at sun.nio.ch.PollSelectorImpl.doSelect(PollSelectorImpl.java:56) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69) - locked <0xae660a28> (a sun.nio.ch.Util$1) - locked <0xae660a18> (a java.util.Collections$UnmodifiableSet) - locked <0xae660668> (a sun.nio.ch.PollSelectorImpl) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:84) at org.apache.mina.transport.socket.nio.SocketAcceptor $Worker.run(SocketAcceptor.java:355) "Session Manager" prio=1 tid=0x8b781740 nid=0xa82 runnable [0x8bafe000..0x8bafef40] at com.threegscene.arg.gp.session.AbstractSessionSink.closeIoSession(AbstractSessionSink.java:122) at com.threegscene.arg.gp.session.DefaultSession.setConnected(DefaultSession.java:286) at com.threegscene.arg.gp.session.SessionManager.scan(SessionManager.java:215) at com.threegscene.arg.gp.session.SessionManager.access $0(SessionManager.java:172) at com.threegscene.arg.gp.session.SessionManager $1.run(SessionManager.java:108) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) "RMI TCP Accept-20702" daemon prio=1 tid=0x8c1d5720 nid=0xa7f runnable [0x8bd0b000..0x8bd0c040] at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) - locked <0x919c3140> (a java.net.SocksSocketImpl) at java.net.ServerSocket.implAccept(ServerSocket.java:450) at java.net.ServerSocket.accept(ServerSocket.java:421) at sun.rmi.transport.tcp.TCPTransport.run(TCPTransport.java:340) at java.lang.Thread.run(Thread.java:595) "RMI TCP Accept-0" daemon prio=1 tid=0x8c1d08f0 nid=0xa7e runnable [0x8bd8c000..0x8bd8d0c0] at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) - locked <0x919c30c8> (a java.net.SocksSocketImpl) at java.net.ServerSocket.implAccept(ServerSocket.java:450) at java.net.ServerSocket.accept(ServerSocket.java:421) at sun.rmi.transport.tcp.TCPTransport.run(TCPTransport.java:340) at java.lang.Thread.run(Thread.java:595) "Timer-0" daemon prio=1 tid=0x8c1ce8f8 nid=0xa7d in Object.wait() [0x8be0d000..0x8be0e140] at java.lang.Object.wait(Native Method) - waiting on <0x919c31b8> (a java.util.TaskQueue) at java.lang.Object.wait(Object.java:474) at java.util.TimerThread.mainLoop(Timer.java:483) - locked <0x919c31b8> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:462) "Low Memory Detector" daemon prio=1 tid=0x086e6f28 nid=0xa7c runnable [0x00000000..0x00000000] "CompilerThread1" daemon prio=1 tid=0x086e59a0 nid=0xa7b waiting on condition [0x00000000..0x8cee2068] "CompilerThread0" daemon prio=1 tid=0x086e4840 nid=0xa7a waiting on condition [0x00000000..0x8cf63028] "AdapterThread" daemon prio=1 tid=0x086e32a8 nid=0xa79 waiting on condition [0x00000000..0x00000000] "Signal Dispatcher" daemon prio=1 tid=0x086e1c38 nid=0xa78 waiting on condition [0x00000000..0x00000000] "JDWP Command Reader" daemon prio=1 tid=0x086e01d8 nid=0xa73 runnable [0x00000000..0x00000000] "JDWP Event Helper Thread" daemon prio=1 tid=0x086df158 nid=0xa72 runnable [0x00000000..0x00000000] "JDWP Transport Listener: dt_socket" daemon prio=1 tid=0x086dd668 nid=0xa71 runnable [0x00000000..0x8d1e8e80] "Finalizer" daemon prio=1 tid=0x086cceb0 nid=0xa6e in Object.wait() [0x8d46a000..0x8d46a1c0] at java.lang.Object.wait(Native Method) - waiting on <0x9195c2e8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116) - locked <0x9195c2e8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159) "Reference Handler" daemon prio=1 tid=0x086cc918 nid=0xa6d in Object.wait() [0x8d4ea000..0x8d4eae40] at java.lang.Object.wait(Native Method) - waiting on <0x91970bb0> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:474) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116) - locked <0x91970bb0> (a java.lang.ref.Reference$Lock) "VM Thread" prio=1 tid=0x086ca488 nid=0xa6c runnable "GC task thread#0 (ParallelGC)" prio=1 tid=0x086431e0 nid=0xa6a runnable "GC task thread#1 (ParallelGC)" prio=1 tid=0x08643e30 nid=0xa6b runnable "VM Periodic Task Thread" prio=1 tid=0x8c1d99d8 nid=0xa80 waiting on condition -- Frederic Soulier <[EMAIL PROTECTED]> OpenPGP key available on http://www.keyserver.net 1024D/BA6700ED 49A6 8E8E 4230 8D41 1ADE B649 3203 1DD2 BA67 00ED
