ClientAbortException,Connection reset by peer: socket write error

  1. extremetable导出excel,弹出一个下载窗口,这时不点下载而点取消,则报下面的异常:   
  2. ClientAbortException  Caused by: java.net.SocketException: Connection reset by peer: socket write error    
  3. 查了下TOMCAT的文档,解释如下:   
  4. Wrap an IOException identifying it as being caused by an abort of a request by a remote client.   
  5. 在BAIDU和GOOGLE上找了下原因,大概归结为:    
  6. ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error的原因是由于处理http连接时,正在输出内容时,用户关闭了IE,会出现一个"ClientAbortException",属于I/O处理中出现的一个异常,应用服务器应该会捕捉。    
  7. Connection reset by peer的原因:    
  8. 经常出现的Connection reset by peer: 原因可能是多方面的,不过更常见的原因是:    
  9. ①:服务器的并发连接数超过了其承载量,服务器会将其中一些连接Down掉;    
  10. ②:客户关掉了浏览器,而服务器还在给客户端发送数据;    
  11. ③:浏览器端按了Stop    
  12. 很多人都说是客户端造成的,没有办法控制,是个比较郁闷的问题。   
  13.   
  14. 但是,我担心的是:虽然前台没有任何出错的迹象,但是后台会记录这个异常,日志也会疯狂爆满,时间长了,肯定会DOWN掉的,还没找到好的解决办法   
  15. resin有一个参数ignore-client-disconnect    
  16. tomcat似乎没有   
  17.   
  18.   
  19.   
  20.   
  21. 经常出现的Connection reset by peer: 原因可能是多方面的,不过更常见的原因是:①:服务器的并发连接数超过了其承载量,服务器会将其中一些连接Down掉;②:客户关掉了浏览器,而服务器还在给客户端发送数据;③:浏览器端按了Stop   
  22.   
  23. [10054] Connection reset by peer   
  24.   Connection reset by peer is a tough one because it can be caused by so many things. In all cases, the server determines that the socket is no longer good and closes it from its side.   
  25.   Read Error   
  26.   Scenario: Mary couldn't make out what Joe was saying anymore, so she hung up rather than lose his messages (data).    
  27.   A read error occurs when a server cannot successfully read from a user's client. Servers gather information from the client by text, setup, and other items.When the server receives an error when reading from a client, it then disconnects the user, resulting in a read error quit message.   
  28.   Write Error    
  29.   Scenario: Mary was trying to talk to Joe but didn't think she was getting through, so she hung rather than lose his messages (data).    
  30.   A write error occurs when a server cannot successfully write to a user's client. When the server receives information, it usually responds with information of its own. When the server receives an error when writing to a client, it then disconnects the user, resulting in a write error quit message similar to the read error format.   
  31.   Ping Timeout Error    
  32.   Scenario: Mary, having been raised in a household with too many kids and always craving attention, keeps asking to make sure that Joe is still on the line and listening. If he doesn't reply fast enough to suit her, she hangs up.    
  33.   Servers automatically ping users at a preset time. The reason for this is to ensure the client is still connected to the server. When you see "PING? PONG!" results in your status window, it means the server has pinged your client, and it has responded back with a pong to ensure the server that you are still connected. When this does not happen and you disconnect without the server's knowledge, the server will automatically disconnect the user when it does not receive a response, resulting in a ping timeout. Ping timeouts occur to EVERYONE.   
  34.   Broken pipe Error    
  35.   Scenario: Mary had picked up a sticky note with a message she needed to relay to Joe, but somehow between her hand and her mouth, the message got misplaced. Mary was trying to talk to Joe but didn't think she was getting through, so she hung up rather than lose his messages (data).    
  36.   A broken pipe error occurs when the server knows it has a message but can't seem to use its internal data link to get the data out to the socket.   
  37.   Miscellaneous    
  38.   Scenario: Lots of other reasons; perhaps the operator broke in and gave Mary a message that made her doubt the validity of the call so she hung up  
 extremetable导出excel,弹出一个下载窗口,这时不点下载而点取消,则报下面的异常:
ClientAbortException  Caused by: java.net.SocketException: Connection reset by peer: socket write error 
查了下TOMCAT的文档,解释如下:
Wrap an IOException identifying it as being caused by an abort of a request by a remote client.
在BAIDU和GOOGLE上找了下原因,大概归结为: 
ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error的原因是由于处理http连接时,正在输出内容时,用户关闭了IE,会出现一个"ClientAbortException",属于I/O处理中出现的一个异常,应用服务器应该会捕捉。 
Connection reset by peer的原因: 
经常出现的Connection reset by peer: 原因可能是多方面的,不过更常见的原因是: 
①:服务器的并发连接数超过了其承载量,服务器会将其中一些连接Down掉; 
②:客户关掉了浏览器,而服务器还在给客户端发送数据; 
③:浏览器端按了Stop 
很多人都说是客户端造成的,没有办法控制,是个比较郁闷的问题。

但是,我担心的是:虽然前台没有任何出错的迹象,但是后台会记录这个异常,日志也会疯狂爆满,时间长了,肯定会DOWN掉的,还没找到好的解决办法
resin有一个参数ignore-client-disconnect 
tomcat似乎没有




经常出现的Connection reset by peer: 原因可能是多方面的,不过更常见的原因是:①:服务器的并发连接数超过了其承载量,服务器会将其中一些连接Down掉;②:客户关掉了浏览器,而服务器还在给客户端发送数据;③:浏览器端按了Stop

[10054] Connection reset by peer
  Connection reset by peer is a tough one because it can be caused by so many things. In all cases, the server determines that the socket is no longer good and closes it from its side.
  Read Error
  Scenario: Mary couldn't make out what Joe was saying anymore, so she hung up rather than lose his messages (data). 
  A read error occurs when a server cannot successfully read from a user's client. Servers gather information from the client by text, setup, and other items.When the server receives an error when reading from a client, it then disconnects the user, resulting in a read error quit message.
  Write Error 
  Scenario: Mary was trying to talk to Joe but didn't think she was getting through, so she hung rather than lose his messages (data). 
  A write error occurs when a server cannot successfully write to a user's client. When the server receives information, it usually responds with information of its own. When the server receives an error when writing to a client, it then disconnects the user, resulting in a write error quit message similar to the read error format.
  Ping Timeout Error 
  Scenario: Mary, having been raised in a household with too many kids and always craving attention, keeps asking to make sure that Joe is still on the line and listening. If he doesn't reply fast enough to suit her, she hangs up. 
  Servers automatically ping users at a preset time. The reason for this is to ensure the client is still connected to the server. When you see "PING? PONG!" results in your status window, it means the server has pinged your client, and it has responded back with a pong to ensure the server that you are still connected. When this does not happen and you disconnect without the server's knowledge, the server will automatically disconnect the user when it does not receive a response, resulting in a ping timeout. Ping timeouts occur to EVERYONE.
  Broken pipe Error 
  Scenario: Mary had picked up a sticky note with a message she needed to relay to Joe, but somehow between her hand and her mouth, the message got misplaced. Mary was trying to talk to Joe but didn't think she was getting through, so she hung up rather than lose his messages (data). 
  A broken pipe error occurs when the server knows it has a message but can't seem to use its internal data link to get the data out to the socket.
  Miscellaneous 
  Scenario: Lots of other reasons; perhaps the operator broke in and gave Mary a message that made her doubt the validity of the call so she hung up

 我在做pdf导出的时候针对大的文件下载过程中点关闭或下载前点取消按钮会报以上错误;先记录下来

 

Java代码 复制代码   收藏代码
  1.     
  2.   
  3. 1,一般是有些客户端已关闭,一些线程因为延迟等原因觉察不到此连接已结束,继续等到到出错   
  4.   
  5. 2,客户端那里不停刷或一个访问/刷新没完成前再刷,要让这个无用的线程死掉   
  6.   
  7. 3,这个问题一般是客户端在连接还没有完全建立的时候就取消连接,比如用户按了浏览器上面的“停止”按钮,一般来说没有什么问题。但是如果频繁出现,就表示很多客户端连接到Apache服务器的响应时间太长了,可能是网络的问题或者服务器性能问题。   
  8.   
  9. 4, 这个问题一般是客户端在连接还没有完全建立的时候就取消连接,比如用户按了浏览器上面的“停止”按钮,一般来说没有什么问题。但是如果频繁出现,就表示很多客户端连接到Apache服务器的响应时间太长了,可能是网络的问题或者服务器性能问题      
  10.   
  11. 5,可能你的网络连接存在一些问题,你的数据传输的时候,可能由于时间等待的太久,但是server段设置的连接检验时间限制一定,那么就可能出现这种情况的!   
  12.   
  13. 6,不过更常见的原因是:   
  14. 1:服务器的并发连接数超过了其承载量,服务器会将其中一些连接Down掉;   
  15. 2:客户关掉了浏览器,而服务器还在给客户端发送数据;   
  16. 3:浏览器端按了Stop;   
  17. 4:服务器给客户端响应结果给防火墙拦截了。   
  18.   
  19. 7,我又查了一些资料,原因如下:   
  20.     非程序问题,一般是由于与客户端连接中断所致,没有太有效的办法解决。但是可以通过系统调优等手段提高系统吞吐量,减少部分因延迟而中断的连接。   
  21.   
  22.     一般免费的Web Server,如Tomcat对长期积累的IO错误解决不完善,会导致迟缓,甚至挡掉。所以,如果你的网站(或系统)访问量较大或至少又一段时间集中访问量大,一定要留意这个问题,因为它可能会使你的系统停滞。   
  23.   
  24.     建议:1、提高系统性能 2、有条件的话换用商业WebServer如weblogic  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值