Connection Reset by peer problem analysis

Source: Internet
Author: User
Tags connection reset

  1. Extremetable export Excel, pop up a download window, then click to cancel the download, then report the following exception:
  2. Clientabortexception caused by:java.net.SocketException:Connection reset by Peer:socket write error
  3. Check out the Tomcat documentation and explain the following:
  4. Wrap an ioexception identifying it as being caused by an abort of a request by a remote client.
  5. Baidu and Google to find the next reason, presumably attributed to:
  6. ClientAbortException:java.net.SocketException:Connection Reset by Peer:socket write error is due to the fact that when the content is being output when the HTTP connection is being processed, When the user closes IE, a "clientabortexception" appears, which is an exception that occurs in I/O processing and should be captured by the application server.
  7. Connection the reason for reset by peer:
  8. Frequently occurring connection reset by peer: The reasons may be manifold, but the more common reasons are:
  9. ①: The number of concurrent connections to the server exceeds its capacity, and the server will drop some of the connections;
  10. ②: The client has turned off the browser and the server is sending data to the client;
  11. ③: Browser-side pressed stop
  12. Many people say that the client-caused, there is no way to control, is a relatively depressed problem.
  13. However, my concern is: Although the front desk does not have any signs of error, but the background will record this anomaly, the log will be crazy full, long time, will be down, have not found a good solution
  14. Resin has a parameter ignore-client-disconnect
  15. Tomcat does not seem to
  16. Frequently occurring connection reset by peer: The reasons may be manifold, but the more common reason is: ①: The number of concurrent connections to the server exceeds its capacity, the server will drop some of these connections; ②: The client shuts down the browser, and the server sends the data to the client. ; ③: Browser side pressed stop
  17. [10054] Connection Reset by peer
  18. Connection reset by Peer are a tough one because it can be caused by so many things. In all cases, the server determines the socket was no longer good and closes it from its side.
  19. Read Error
  20. Scenario:mary couldn ' t make out what Joe is saying anymore, so she hung up rather than lose he messages (data).
  21. 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 is reading from a client, it then disconnects the user, resulting in a read error quit Message.
  22. Write Error
  23. Scenario:mary is trying to talk to Joe but didn ' t think she is getting through, so she hung the rather than lose his messag ES (data).
  24. A write error occurs when the a server cannot successfully write to a user ' s client. When the server is receives information, it usually responds with information of its own. When the server receives an error is writing to a client, it then disconnects the user, resulting in a write error quit Message similar to the read error format.
  25. Ping Timeout Error
  26. Scenario:mary, has been raised in a household with too many kids and always craving attention, keeps asking to make Su Re that Joe was still on the line and listening. If He doesn ' t reply fast enough to suit hers, she hangs up.
  27. Servers automatically ping users at a preset time. The reason for the-is-ensure the client is a still connected to the server. When do you see "PING?" pong! "Results in your status window, it means the server had pinged your client, and it had responded back with a PONG to Ensure the server is still connected. When this does isn't happen and you disconnect without the server ' s knowledge, the server would automatically disconnect the User when it does not receive a response, resulting in a ping timeout. Ping timeouts occur to EVERYONE.
  28. Broken Pipe Error
  29. 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 is getting through, so she-hung up rather than lose his messages (dat a).
  30. A broken pipe error occurs when the server knows it have a message but can ' t seem-use it internal data link to get the Data out to the socket.
  31. Miscellaneous
  32. 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

I do the PDF export when the point of the large file download process to close or download the previous click the Cancel button will report the above error;

Java code
    1. 1, usually some clients have been shut down, some threads because of delay and other reasons not aware of this connection has ended, continue to wait until the error
    2. 2, the client there is not going to brush or a visit/refresh is not finished before the brush, to let this useless thread die
    3. 3, this problem is generally the client when the connection is not fully established when the connection is canceled, such as the user pressed the browser above the "Stop" button, generally there is no problem. However, if frequent, it means that many clients connect to the Apache server response time is too long, may be a network problem or server performance issues.
    4. 4, this problem is generally the client when the connection is not fully established when the connection is canceled, such as the user pressed the browser above the "Stop" button, generally there is no problem. However, if it occurs frequently, it means that many clients have a long response time to the Apache server, which may be a network problem or a server performance issue.
    5. 5, there may be some problems with your network connection, your data transmission time, may be due to the time to wait too long, but the server section set the connection inspection time limit is certain, then this situation may occur!
    6. 6, but the more common reason is:
    7. 1: The number of concurrent connections to the server exceeds its capacity, and the server will drop some of these connections;
    8. 2: The client has turned off the browser, and the server is sending data to the client;
    9. 3: Browser-side pressed stop;
    10. 4: The server has blocked the firewall by giving the client response results.
    11. 7, I have also checked some information for the following reasons:
    12. Non-procedural problems, usually due to the interruption of connection with the client, there is no way to solve the problem. However, it can improve the system throughput through system tuning, and reduce some of the connections interrupted by the delay.
    13. Generally free web Server, such as Tomcat, is not perfect for long-term accumulated IO errors, which can lead to slowness or even blocking. So, if your site (or system) has a large amount of access or at least another period of time, be sure to keep an eye on the problem, as it may cause your system to stall.
    14. Recommendation: 1, improve the system performance 2, conditional on trade webserver such as WebLogic

The 1th exception is java.net.BindException:Address already in Use:jvm_bind. This exception occurs when the server side operates on a new ServerSocket (port is an integer value of 0,65536). The exception is due to the fact that a port is already being started and is listening. At this point, with the Netstat–an command, you can see a port with a listending status. Just find an unoccupied port to solve this problem.

The 2nd exception is Java.net.ConnectException:Connection Refused:connect. This exception occurs when the client makes a new Socket (IP, Port) operation because the exception occurs because either the machine with the IP address cannot be found (that is, the current machine does not exist to the specified IP route), or the IP exists, but the specified port is not found for listening. This problem occurs, first check the client's IP and port is wrong, if it is correct to ping the server from the client to see if it can ping, if you can ping (the service server to ping off the need for another method), the server-side listening to the specified port program is started, This will certainly solve the problem.

The 3rd exception is the Java.net.SocketException:Socket is closed, which can occur on both the client and the server. The reason for the exception is that you have actively closed the connection (called the Close method of the socket) and read and write the network connection.

The 4th exception is java.net.SocketException: (Connection reset or connect reset by Peer:socket write error). This exception can occur on both the client and the server side, causing the exception to be two, the first of which is if the socket on one end is turned off (or closed by an unexpected exit), the other end still sends the data, and the first packet that is sent throws the exception (Connect reset by Peer). The other is one end exiting, but the connection is not closed when exiting, and the other end throws the exception if the data is read from the connection (Connection reset). The simple thing is that the read and write operations are caused by the disconnection of the connection.

The 5th exception is the Java.net.SocketException:Broken pipe. This exception can occur on both the client and the server. In the first case of the 4th exception (that is, after you throw socketexcepton:connect reset by Peer:socket write error), the exception is thrown if you continue to write the data. The solution to the first two exceptions is to first ensure that all network connections are closed before the program exits, followed by detection of the other's closed connection operation, and that the other person closes the connection after closing the connection.
http://bbs.csdn.net/topics/340021801
Http://www.jb51.net/article/34888.htm

Common reasons for Connection reset by peer:  1) The number of concurrent connections to the server exceeds its capacity, and the server shuts down some of the connections;    If you know that the number of concurrent clients actually connected to the server does not exceed the server's load capacity, It is possible that a virus or trojan, causing network traffic anomalies. You can use Netstat-an to view network connections. &NBSP;2) The client has turned off the browser and the server is sending data to the client, 3) The browser has pressed stop;     These two situations generally do not affect the server. However, if the exception information is not handled specifically, it is possible to duplicate the exception in the server's log file, causing the server log file too large to affect the server's operation. You can use Try...catch to catch the exception to the part that caused the exception, and then do not output or just output a single prompt message, avoid using e.printstacktrace (), and output all exception information. &NBSP;4) Firewall Issues;    If the network connection through the firewall, and the firewall generally has a time-out mechanism, when the network connection does not transfer data for a long time, the TCP session will be closed, read and write after the shutdown, will cause an exception. If you turn off the firewall, the problem is resolved, you need to reconfigure the firewall, or you write your own program to implement TCP long connections. To implement TCP long connection, you need to define the heartbeat protocol, every time, send a heartbeat protocol, both sides maintain the connection. 5) The buffer problem of JSP.   &NBSP;JSP page Default cache is 8k, when the JSP page data is relatively large, it is possible that the JSP is not completely passed to the browser. The buffer size can then be adjusted appropriately. <%@ page buffer= "100k"%>  common network exceptions (go from http://www.cnblogs.com/kaixin110/archive/2008/04/11/1148671.html):   1th exception is java.net.BindException:Address already in Use:jvm_bind. This exception occurs when the server side operates on a new serversocket  (port is an integer value of 0,65536). The exception is due to the fact that a port is already being started and is listening. At this point, with the  netstat–an command, you can see a port with a listending status. Just find an unoccupied port to solve this problem. &nbThe 2nd exception of sp;  is Java.net.ConnectException:Connection refused:connect. This exception occurs when the client makes a new Socket (IP, port)   operation, either because the machine with the IP address cannot be found (that is, from the current machine does not exist to the specified IP route), or the IP exists   However, the specified port could not be found for listening. This problem occurs, first check the client's IP and port is wrong, if it is correct to ping the server from the client   see if it can ping, if you can ping (the service server to ping off the need for another method), Look at the server-side listening to the specified port of the program is   start, this will certainly solve the problem.     3rd exception is the Java.net.SocketException:Socket is closed, which can occur on both the client and the server. The reason for the exception is that the active shut-down   closed the connection (called the Close method of the socket) and read and write the network connection.     4th exception is java.net.SocketException: (Connection reset or Connect reset by Peer:socket write error). This exception   can occur on both the client and server side, causing the exception to be two, the first one is if the socket on one end is closed (or is closed either actively or due to an XOR exit), the other end still sends the data, and the first packet sent throws the exception ( Connect reset by Peer). The other is one end exiting &nbsp, but the connection is not closed when exiting, and the other end throws the exception if it reads data from the connection (Connection reset). In short, it is caused by the read and write operation of   after the connection is broken.     5th exception is Java.net.SocketException:Broken pipe. This exception can occur on both the client and the server. In the first case of the 4th exception   (that is, after throwing socketexcepton:connect reset by Peer:socket write error), the exception is thrown if you continue to write the data. The top two different   common solutions are to first ensure that the program exits beforeClose all network connections, followed by the detection of the other side of the connection operation, found that the other side closed the connection itself to   close the connection.    Client error code 10053 software caused connection abort (software cause connection interruption)

Connection Reset by peer problem analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.