Help Center> Cloud Container Engine> FAQs> Networking> Network Fault> What Should I Do If the Java Error "Connection reset by peer" Is Reported During Layer-4 ELB Health Check
Updated on 2024-07-04 GMT+08:00

What Should I Do If the Java Error "Connection reset by peer" Is Reported During Layer-4 ELB Health Check

Complete Error Information

java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:197)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at com.wanyu.smarthome.gateway.EquipmentSocketServer.handleReadEx(EquipmentSocketServer.java:245)
at com.wanyu.smarthome.gateway.EquipmentSocketServer.run(EquipmentSocketServer.java:115)

Analysis Results

A socket server is established using Java Non-blocking I/O (NIO). When the client is shut down unexpectedly rather than sending a specified notification to instruct the server to exit, an error is reported.

TCP Health Check Process

  1. The ELB node that performs health checks sends an SYN packet to the backend server (private IP address+health check port) based on the health check configuration.
  2. After receiving the packet, the backend server returns an SYN-ACK packet over its port.
  3. If the ELB node does not receive the SYN-ACK packet within the timeout duration, the backend server is declared unhealthy. Then, the ELB node sends an RST packet to the backend server to terminate the TCP connection.
  4. If the ELB node receives the SYN-ACK packet from the backend server within the timeout duration, it sends an ACK packet to the backend server and declares that the backend server is healthy. Then, the ELB node sends an RST packet to the backend server to terminate the TCP connection.

Note

After a normal TCP three-way handshake, there will be data transfer. However, an RST packet will be sent to terminate the TCP connection during the health check. The applications on the backend server may determine a connection error and reports a message, for example, "Connection reset by peer".

This error is justified and unavoidable. You can ignore it.

Network Fault FAQs

more