> -----Original Message-----
> From: mat [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 09, 2007 12:54 PM
> To: [email protected]
> Subject: Re: using SocketConnector on not reachable address result in full
> cpu
> 
> 1)  Please don't double post the same thread. Thanks.


Yep. Sorry:)

> 2)  Did you catch RuntimeIOException after ConnectFuture future =
> connector.connect()? The reconnect in a infinite loop without
> Thread.sleep()
> normally causes 100% CPU usage.
> 



Exception is handled and There's no infinite loop or retry. Following is the
test code.


                connector = new
SocketConnector(Runtime.getRuntime().availableProcessors() + 1,
Executors.newCachedThreadPool());
                VMPCodecFactory cf = new VMPCodecFactory();

                connector.getFilterChain().addLast(
                                "codec",
                                new ProtocolCodecFilter(cf));
                connector.getFilterChain().addLast("StreamWriter", new
StreamWriteFilter());
                connector.getFilterChain().addLast("threadPool", new
ExecutorFilter(Executors.newCachedThreadPool()));
                connector.getFilterChain().addLast( "logger", new
LoggingFilter() );

                connector.setHandler(new SingleSessionIoHandlerDelegate(new
SingleSessionIoHandlerFactory() {
                        public SingleSessionIoHandler getHandler(IoSession
session) {
                                return new TestHandler(session);
                        }
                }));

                ...

                try
                {
                ConnectFuture future = connector.connect( new
InetSocketAddress(addr, port) );
                future.addListener(new IoFutureListener() {
                        public void operationComplete(IoFuture future)
                        {
                                Exception handling here too but doesn't
reach here
                        }
                ...
                }
                catch(RuntimeException e)


As I mentioned previously, Handler's sessionOpened() is magically called
even though the machine is turned off.
And after that, no further progress, and cpu goes up to 50% for that single
connection.
No error or exception returned.

Thanks


Reply via email to