问答详情
源自:5-8 WebSocket客户端JS脚本的实现

io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1

有人知道这个报错怎么解决么

D:\java\jdk\jdk1.8.0_05\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54925,suspend=y,server=n -javaagent:C:\Users\Administrator\.IntelliJIdea2018.1\system\captureAgent\debugger-agent.jar=file:/C:/Users/Administrator/AppData/Local/Temp/capture.props -Dfile.encoding=UTF-8 -classpath "D:\java\jdk\jdk1.8.0_05\jre\lib\charsets.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\deploy.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\access-bridge-64.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\cldrdata.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\dnsns.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\jaccess.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\jfxrt.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\localedata.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\nashorn.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\sunec.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\sunjce_provider.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\sunmscapi.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\sunpkcs11.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\ext\zipfs.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\javaws.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\jce.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\jfr.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\jfxswt.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\jsse.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\management-agent.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\plugin.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\resources.jar;D:\java\jdk\jdk1.8.0_05\jre\lib\rt.jar;D:\DevRepostory\IdeaProjects\netty\out\production\netty;D:\DevRepostory\IdeaProjects\netty\lib\netty-all-4.1.28.Final.jar;D:\DevInstall\JetBrains\IntelliJ IDEA 2018.1.3\lib\idea_rt.jar" com.anhw.netty.Main

Connected to the target VM, address: '127.0.0.1:54925', transport: 'socket'

服务端开启,等待客户端连接。。。

客户端与服务端建立连接。。。

io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1

at io.netty.buffer.AbstractReferenceCountedByteBuf.release0(AbstractReferenceCountedByteBuf.java:100)

at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:84)

at io.netty.handler.codec.http.HttpObjectAggregator$AggregatedFullHttpMessage.release(HttpObjectAggregator.java:386)

at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:88)

at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:112)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)

at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)

at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)

at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)

at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)

at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)

at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)

at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)

at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646)

at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)

at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)

at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)

at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)

at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

at java.lang.Thread.run(Thread.java:745)

Disconnected from the target VM, address: '127.0.0.1:54925', transport: 'socket'


Process finished with exit code -1


提问者:mouker 2018-08-18 14:14

个回答

  • 键盘瞎
    2018-08-19 20:48:17

    需要在对象CloseWebSocketFrame的初始化时引用人为+1