szhnet / kcp-netty

Java implementation of KCP based on Netty. 基于netty实现的java版kcp。
MIT License
329 stars 110 forks source link

io.jpower.kcp.netty.KcpException: State=-1 after update() #8

Closed davie1008 closed 6 years ago

davie1008 commented 6 years ago

问题1: io.jpower.kcp.netty.KcpException: State=-1 after update() at io.jpower.kcp.netty.UkcpClientChannel.run(UkcpClientChannel.java:298) at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:125) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:745)

在使用demo测试过程中,发现跑一段时间后就会报这个问题,网络环境是本地电脑模拟服务器和客户端,网络应该不成问题,但是还是会出现deadLink超过20次的问题,请教下kcp的C代码中没有断开连接的做法,不知道您这边基于什么考虑要将客户端断开连接?

问题2: 我们系统集成中,发现会存在netty的内存泄露问题,提示的报错信息集中在: io.netty.buffer.AdvancedLeakAwareByteBuf.readRetainedSlice(AdvancedLeakAwareByteBuf.java:106) kcp.netty.Kcp.input(Kcp.java:999) kcp.netty.Ukcp.input(Ukcp.java:51) kcp.netty.UkcpServerChildChannel.kcpInput(UkcpServerChildChannel.java:192) kcp.netty.UkcpServerChannel$UkcpServerUnsafe.read(UkcpServerChannel.java:566) 以上两个问题,请帮忙看看,是否我在使用中有什么注意点,不胜感谢!

wuruilong007 commented 6 years ago

我也遇到第一个问题,第一个问题最后解决了么?

peererror commented 5 years ago

how do you resolve this issue .I am getting the same error

slive commented 4 years ago

估计是有不合法的kcp-UDP包,会导致抛出异常,然后关闭,C是忽略,所以没问题。我的做法是修改源码异常处理,针对这种异常,不做关闭就好了