Infinite error loop on read time out.

"Trustin Lee (이희승)" trustin at gmail.com
Thu May 6 00:19:04 EDT 2010


You have overridden the messageReceived() method, which updates the last
read time and did not call super.messageReceived().  Therefore, last
read time remains same even if data is received and that's why you are
getting many timeouts.

HTH,
Trustin

infectedrhytms wrote:
> Hi I got an infinite loop on read time out error where the CPU just maxed at
> 100% and the error never stops printing...
> 
> Using Netty 3.1.5 GA
> 
> My pipeline
> 
> pipeline.addLast("framer", new
> myHeaderDecoder(Constants.DefaultLengthHeader));
> pipeline.addLast("StringDecoder", StringDecoder);
> pipeline.addLast("timeout", new RequestReadTimeoutHandler(hashedWheelTimer,
> timeout));		
> pipeline.addLast("StringEncoder", StringEncoder);
> pipeline.addLast("threaded", executionHandler);
> pipeline.addLast("encoderdecoder", new MessageEncoderDecoder());
> pipeline.addLast("MyHandler", new MyHandler());
> 
> The timeout handler...
> 
> @ChannelPipelineCoverage("one")
> public class RequestReadTimeoutHandler extends ReadTimeoutHandler {
> 
> 	private static final LogHelper logHelper = LogHelper.getInstance();
> 	
> 	public RequestReadTimeoutHandler(Timer timer, int timeoutSeconds) {
> 		super(timer, timeoutSeconds);
> 		// TODO Auto-generated constructor stub
> 	}
> 
> 	@Override
> 	//In case of read timeout,send back a response and close the channel 
> 	protected void readTimedOut(ChannelHandlerContext ctx) {
> 		logHelper.logError("Read timeout error.");
> 		ChannelFuture cf =
> ctx.getChannel().write(Constants.MPIRequestTooShortResponse);
> 
> 		// Will close the channel once the write is done.
> 		cf.addListener(ChannelFutureListener.CLOSE);
> 		releaseExternalResources();
> 	}
> 	//It has already been processed, do not need to timeout again
> 	@Override
> 	public void messageReceived(ChannelHandlerContext ctx,
>             MessageEvent e)
> 	{
> 		Object message = e.getMessage();
> 		logHelper.debug(message.getClass().toString());
> 		if (message instanceof String)
> 		{
> 			if(((String) message).length()>Constants.DefaultLengthHeader)
> 				releaseExternalResources();
> 		}
> 		Channels.fireMessageReceived(ctx, message);
> 	}
> }
> 
> And basically "Read timeout error..." just keeps printing over and over on
> the console window non stop and it never seems to stop...
> 
> Any ideas thanks

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100506/be7832a3/attachment-0001.bin 


More information about the netty-users mailing list