netty上傳文件bug



   以前公司有個同事離職,而後我交接了他的一些項目,其中有一個日誌項目,主要就是業務部門調用Client往服務器上傳日誌文件,這個過程使用了netty,問題很奇怪大體以下:java

1:一天中總有那麼幾個文件會上傳失敗報的異常信息是:git

20:08:03.937] WARN  DefaultPromise - An exception was thrown by io.netty.handler.stream.ChunkedWriteHandler$2.operationComplete()
[20:08:03.937] java.lang.IllegalStateException: complete already: DefaultChannelPromise@4dd2405f(failure(io.netty.handler.codec.EncoderException: io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1)
[20:08:03.937]     at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:393) [DefaultPromise.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelPromise.setSuccess(DefaultChannelPromise.java:76) [DefaultChannelPromise.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelPromise.setSuccess(DefaultChannelPromise.java:71) [DefaultChannelPromise.class:4.0.15.Final]
[20:08:03.937]     at io.netty.handler.stream.ChunkedWriteHandler$PendingWrite.success(ChunkedWriteHandler.java:352) ~[ChunkedWriteHandler$PendingWrite.class:4.0.15.Final]
[20:08:03.937]     at io.netty.handler.stream.ChunkedWriteHandler$2.operationComplete(ChunkedWriteHandler.java:273) ~[ChunkedWriteHandler$2.class:4.0.15.Final]
[20:08:03.937]     at io.netty.handler.stream.ChunkedWriteHandler$2.operationComplete(ChunkedWriteHandler.java:269) ~[ChunkedWriteHandler$2.class:4.0.15.Final]
[20:08:03.937]     at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:631) [DefaultPromise.class:4.0.15.Final]
[20:08:03.937]     at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:558) [DefaultPromise.class:4.0.15.Final]
[20:08:03.937]     at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:399) [DefaultPromise.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:82) [DefaultChannelPromise.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.ChannelOutboundBuffer.remove(ChannelOutboundBuffer.java:270) [ChannelOutboundBuffer.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.nio.AbstractNioByteChannel.doWrite(AbstractNioByteChannel.java:216) [AbstractNioByteChannel.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:231) [NioSocketChannel.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:682) [AbstractChannel$AbstractUnsafe.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:283) [AbstractNioChannel$AbstractNioUnsafe.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:651) [AbstractChannel$AbstractUnsafe.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelPipeline$HeadHandler.flush(DefaultChannelPipeline.java:1038) [DefaultChannelPipeline$HeadHandler.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelHandlerContext.invokeFlush(DefaultChannelHandlerContext.java:675) [DefaultChannelHandlerContext.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelHandlerContext.flush(DefaultChannelHandlerContext.java:656) [DefaultChannelHandlerContext.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115) [ChannelOutboundHandlerAdapter.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.CombinedChannelDuplexHandler.flush(CombinedChannelDuplexHandler.java:198) [CombinedChannelDuplexHandler.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelHandlerContext.invokeFlush(DefaultChannelHandlerContext.java:675) [DefaultChannelHandlerContext.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelHandlerContext.flush(DefaultChannelHandlerContext.java:656) [DefaultChannelHandlerContext.class:4.0.15.Final]
[20:08:03.937]     at io.netty.handler.stream.ChunkedWriteHandler.doFlush(ChunkedWriteHandler.java:311) [ChunkedWriteHandler.class:4.0.15.Final]
[20:08:03.937]     at io.netty.handler.stream.ChunkedWriteHandler.flush(ChunkedWriteHandler.java:141) [ChunkedWriteHandler.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelHandlerContext.invokeFlush(DefaultChannelHandlerContext.java:675) [DefaultChannelHandlerContext.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelHandlerContext.access$1600(DefaultChannelHandlerContext.java:29) [DefaultChannelHandlerContext.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.DefaultChannelHandlerContext$WriteTask.run(DefaultChannelHandlerContext.java:908) [DefaultChannelHandlerContext$WriteTask.class:4.0.15.Final]
[20:08:03.937]     at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [SingleThreadEventExecutor.class:4.0.15.Final]
[20:08:03.937]     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) [NioEventLoop.class:4.0.15.Final]
[20:08:03.937]     at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:4.0.15.Final]
[20:08:03.937]     at java.lang.Thread.run(Thread.java:662) [na:1.6.0_23]

不管重傳多少次都是同樣的信息,並且服務器也沒有收到鏈接請求。github

2:後續針對這種狀況修改了一些代碼,前面的問題解決了,可是偶爾會有那麼幾個文件內容傳不到服務器,也就是服務器接收的是空文件。服務器

以後再gitgub上open issue地址爲:socket

https://github.com/netty/netty/issues/3303ide

相關文章
相關標籤/搜索