Skip to content
MtrXTools

java.net.SocketTimeoutException: Read timed out

The server took too long to send data

Seen in Java, Spring RestTemplate and WebClient, Apache HttpClient, JDBC drivers

The connection was open, but no data arrived within the socket read timeout.

Common causes

  • The server or a database behind it is slow or stuck.
  • The read timeout is shorter than the request legitimately needs.
  • A proxy or load balancer silently dropped an idle connection.

How to fix it

  1. Measure how long the endpoint takes and set the read timeout above that.
  2. Check server logs and upstream latency.
  3. Lower connection pool idle times below the proxy idle timeout, and retry idempotent calls.
Measure connection latency

Got a different message? Paste it into the error explainer.

Related errors

All 32 Languages & runtimes errors