`

ClientAbortException,Connection reset by peer: socket write error

阅读更多
 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导出的时候针对大的文件下载过程中点关闭或下载前点取消按钮会报以上错误;先记录下来

 

 

1,一般是有些客户端已关闭,一些线程因为延迟等原因觉察不到此连接已结束,继续等到到出错

2,客户端那里不停刷或一个访问/刷新没完成前再刷,要让这个无用的线程死掉

3,这个问题一般是客户端在连接还没有完全建立的时候就取消连接,比如用户按了浏览器上面的“停止”按钮,一般来说没有什么问题。但是如果频繁出现,就表示很多客户端连接到Apache服务器的响应时间太长了,可能是网络的问题或者服务器性能问题。

4, 这个问题一般是客户端在连接还没有完全建立的时候就取消连接,比如用户按了浏览器上面的“停止”按钮,一般来说没有什么问题。但是如果频繁出现,就表示很多客户端连接到Apache服务器的响应时间太长了,可能是网络的问题或者服务器性能问题   

5,可能你的网络连接存在一些问题,你的数据传输的时候,可能由于时间等待的太久,但是server段设置的连接检验时间限制一定,那么就可能出现这种情况的!

6,不过更常见的原因是:
1:服务器的并发连接数超过了其承载量,服务器会将其中一些连接Down掉;
2:客户关掉了浏览器,而服务器还在给客户端发送数据;
3:浏览器端按了Stop;
4:服务器给客户端响应结果给防火墙拦截了。

7,我又查了一些资料,原因如下:
    非程序问题,一般是由于与客户端连接中断所致,没有太有效的办法解决。但是可以通过系统调优等手段提高系统吞吐量,减少部分因延迟而中断的连接。

    一般免费的Web Server,如Tomcat对长期积累的IO错误解决不完善,会导致迟缓,甚至挡掉。所以,如果你的网站(或系统)访问量较大或至少又一段时间集中访问量大,一定要留意这个问题,因为它可能会使你的系统停滞。

    建议:1、提高系统性能 2、有条件的话换用商业WebServer如weblogic

 

分享到:
评论

相关推荐

    org.apache.catalina.connector.ClientAbortException和TOMCAT的日志配置

    问题1:TOMCAT下载文件出错:org.apache.catalina.connector.ClientAbortException. 问题2:TOMCAT记录接收数据大小、发送数据大小和请求处理时间

    解决struts2下载异常的jar包 struts2-sunspoter-stream-1.0.jar

    21:23:44,676 WARN StreamResult:45 - StreamResultX Warn : socket write error 如果出现该警告说明正确执行,该警告说明,Socket非正常中断,但是流确实已经关闭,自此再也不用看到上面出现的讨厌异常结果。 ...

    java-poi-excel-导出20万条记录

    java-poi-excel-导出20万条记录

    POI的学习笔记

    ### POI学习笔记知识点解析 #### 一、POI简介 Apache POI是一个开源的Java API,用于处理Microsoft Office格式的文件,包括Excel (.xls, .xlsx), PowerPoint (.ppt, .pptx) 和 Word (.doc, .docx)。...

    笔记笔记笔记

    根据提供的信息,我们可以总结出... error: function(xhr, status, error) { // 处理错误情况 } }); ``` 以上是根据提供的信息整理的Java相关知识点。希望这些内容能够帮助你更好地理解和掌握Java及其相关技术。

    springmvc提供视频播放功能时,手机端无法正常播放的解决办法

    3. **错误信息**:后台抛出`ClientAbortException`异常,提示为`IOException:null`。 4. **特殊行为**:手机默认浏览器在请求视频时,会同时向后台发送两个请求。 针对这些问题,我们首先排除了一些常见的原因,...

    struts下载

    - **ClientAbortException**:当客户端中断连接时可能会抛出`ClientAbortException`。这通常是由于网络问题或客户端操作导致的。 #### 4. 其他注意事项 - 在实际开发中,建议使用Apache Commons IO库中的`IOUtils....

    struts2-sunspoter-stream-1.0.jar

    在我们做struts2文件下载的时候,经常会遇到这种问题:点“打开/保存”一切正常,但当我们点击“取消”时,却报一堆的异常(其中包括ClientAbortException异常),附件中使用struts2-sunspoter-stream-1.0.jar插件可...

    Struts2下载文件点击取消出现的异常解决办法(含demo)

    在我们做struts2文件下载的时候,经常会遇到这种问题:点“打开/保存”一切正常,但当我们点击“取消”时,却报一堆的异常(其中包括ClientAbortException异常),非常让人头疼,如何彻底解决呢?附件中使用struts2-...

Global site tag (gtag.js) - Google Analytics