在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java/ netty Connection reset by peer 怎么解決

netty Connection reset by peer 怎么解決

netty經(jīng)常報這樣異常,特別頻繁

查tcp連接數(shù)只有3個,但是頻繁的報這個異常

報錯信息

java.io.IOException: Connection reset by peer

at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:1.7.0_55]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:1.7.0_55]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:1.7.0_55]
at sun.nio.ch.IOUtil.read(IOUtil.java:192) ~[?:1.7.0_55]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379) ~[?:1.7.0_55]
at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) ~[netty-buffer-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:881) ~[netty-buffer-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:241) ~[netty-transport-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [netty-transport-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [netty-transport-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [netty-transport-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [netty-transport-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [netty-transport-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) [netty-common-4.0.27.Final.jar!/:4.0.27.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-common-4.0.27.Final.jar!/:4.0.27.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_55]
回答
編輯回答
礙你眼

這個比較復(fù)雜,主要有幾種情況:
1)服務(wù)器的并發(fā)連接數(shù)超過了其承載量,其中包括等待關(guān)閉的鏈接,可以使用netstat -an查看網(wǎng)絡(luò)連接情況。
2)客戶端強制關(guān)閉鏈接,而服務(wù)器沒有感知,還以為是正常鏈路繼續(xù)向客戶端發(fā)送數(shù)據(jù);
3)防火墻的問題,如果網(wǎng)絡(luò)連接通過防火墻,而防火墻一般都會有超時的機制,在網(wǎng)絡(luò)連接長時間不傳輸數(shù)據(jù)時,會關(guān)閉這個TCP的會話,關(guān)閉后在讀寫,就會導(dǎo)致異常

2017年7月15日 00:22