Le 06/05/15 05:24, 白玉雄 a écrit : > Hi all, > My mina server neither process session request nor disconnect the session as > idle. and this happens only on few of sessions, most of them works well. > > > Some Code: > public void run(int port) throws IOException { > this.acceptor = new NioSocketAcceptor(); > this.acceptor.setReuseAddress(true); > > > this.acceptor.getFilterChain().addLast("codec",new > ProtocolCodecFilter(new ClwMessageProtocolCodecFactory())); > > > this.acceptor.getFilterChain().addLast("logger", new > LoggingFilter()); > this.acceptor.getFilterChain().addLast("threadPool", new > ExecutorFilter(new > UnorderedThreadPoolExecutor(PropertiesHander.getInt("MAXIMUM_POOL_SIZE", > 16)))); > > > this.acceptor.getSessionConfig().setReadBufferSize(512); > this.acceptor.getSessionConfig().setReceiveBufferSize(512); > // set idle time, default 900 seconds > > this.acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,PropertiesHander.getInt("SESSION_IDLE_TIME",900)); > this.acceptor.setHandler(ioHandler); > this.acceptor.bind(new InetSocketAddress(port)); > LOGGER.info("Socket server Listening on port "+ > PropertiesHander.getInt("SERVER_PORT", port)); > } > > > > Some phenomenons: > 1、The ghost session can be found by > this.acceptor.getManagedSessions().get(sessionId) > 2、If force the client disconnect from server and reconnect again, the client > now works well and request was processed normally. > > It seems that the session was stucked. > > > Question: > Why this happens No idea... You aren't providing enough information to know what's going on.
> and How to reappear and debug this? Setting the idle time is good, but at some point you must check the event that is fired when teh session has been idle for 900 seconds. Are you doing that ?