6-2 - Client Timeout

6-2 - Client Timeout

Timeout occurs when the caller is unable to receive a corresponding response within a specified time after sending the request.

Possible Causes

  1. The server is indeed processing slowly and cannot return results within the specified time, causing the caller to automatically return a timeout exception response to terminate the call.
  2. If the server responds quickly, but when the client is under heavy load, issues like requests being unable to be sent or responses getting stuck in the TCP Buffer can cause timeouts. This is because data sent from the server or requests from the client get queued at the system level, and if system load is high, the kernel time will increase, resulting in a timeout by the time the client receives the value.
  3. Usually, this is due to slow business processing. You can execute jstack [PID] > jstack.log on the service provider’s machine to analyze where the threads are stuck, identifying the cause of slowness. If performance cannot be optimized, consider increasing the timeout threshold.

Troubleshooting and Resolution Steps

  1. Both sides may have GC occurring. Check the GC logs on both the server and client. Prolonged GC can lead to timeouts. The occurrence of a timeout likely indicates resource bottlenecks (CPU, memory, or network) on either the caller or server; thus, it’s necessary to check for GC jitter, among other issues.
  2. Check the network quality of the server, such as retransmission rates to rule out network issues.
  3. Utilize link tracing analysis services (like Alibaba’s ARMS, open-source implementations of OpenTracing, Zipkin, SkyWalking, etc.) to analyze the timing of each point.

This error code’s FAQ page references Kong Ming’s article “Common Errors and Solutions in Dubbo”.
The cited article permits compilation under the CC-BY-4.0 license. Special thanks to the original author.