Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.2客户端消费数据出现netty解码错误 #42

Open
duke88 opened this issue Jul 23, 2018 · 2 comments
Open

2.4.2客户端消费数据出现netty解码错误 #42

duke88 opened this issue Jul 23, 2018 · 2 comments
Labels

Comments

@duke88
Copy link

duke88 commented Jul 23, 2018

2018-07-23 18:13:48.381 [nioEventLoopGroup-11-1] WARN [{}] Uncaught exception in connection pipeline
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(8) + length(1034) exceeds writerIndex(1022): PooledUnsafeHeapByteBuf(ridx: 8, widx: 1022, cap: 1024)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) ~[netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:312) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:286) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1304) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:921) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:135) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-all-4.0.56.Final.jar:4.0.56.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: java.lang.IndexOutOfBoundsException: readerIndex(8) + length(1034) exceeds writerIndex(1022): PooledUnsafeHeapByteBuf(ridx: 8, widx: 1022, cap: 1024)
at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1161) ~[netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1148) ~[netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:697) ~[netty-all-4.0.56.Final.jar:4.0.56.Final]
at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:705) ~[netty-all-4.0.56.Final.jar:4.0.56.Final]
at com.youzan.nsq.client.network.netty.NSQDecoder.decode(NSQDecoder.java:35) ~[NSQ-Client-2.4.2.jar:?]
at com.youzan.nsq.client.network.netty.NSQDecoder.decode(NSQDecoder.java:15) ~[NSQ-Client-2.4.2.jar:?]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[netty-all-4.0.56.Final.jar:4.0.56.Final]
... 24 more
2018-07-23 18:13:48.381 [nioEventLoopGroup-11-1] INFO [{}] Disconnect from nsqd 172.17.0.250:4150, RoundRecord, 0, false ...

@duke88 duke88 changed the title nsq消费数据出现netty解码错误 2.4.2客户端消费数据出现netty解码错误 Jul 23, 2018
@DoraALin
Copy link
Contributor

@duke88 堆栈中的netty的版本是4.0.56,这个版本没有测试过。建议使用4.1.13 final。另外客户端的配置和nsq的信息可以提供一下,方便复现。

@duke88
Copy link
Author

duke88 commented Jul 24, 2018

更换到netty4.1.13依然出现这个问题,都是采用的默认配置,客户端打开了压缩DEFLATE,压缩级别3,打开了自动FIN,只要消息多一点就会时不时报如下错误:

2018-07-24 18:30:22.495 [nioEventLoopGroup-5-6] ERROR [{}] Un recognized NSQ Frame! Please check NSQ protocol!
2018-07-24 18:30:22.495 [nioEventLoopGroup-5-6] WARN [{}] Uncaught exception in connection pipeline
io.netty.handler.codec.DecoderException: com.youzan.nsq.client.exception.NSQException: Bad frame id from server (16777216). It will be disconnected!

2018-07-24 18:29:57.779 [nioEventLoopGroup-6-8] WARN [{}] Uncaught exception in connection pipeline
io.netty.handler.codec.DecoderException: java.lang.NegativeArraySizeException

2018-07-24 18:30:11.522 [nioEventLoopGroup-3-2] WARN [{}] Uncaught exception in connection pipeline
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(8) + length(131068) exceeds writerIndex(76): PooledUnsafeHeapByteBuf(ridx: 8, widx: 76, cap: 128)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants