FAQ
Keep-Alive connections
How long idle connections stay open, and why it matters.
The question: Why do I sometimes get "connection reset" errors from my load balancer, and what is idleTimeoutSeconds?
Opening a connection (TCP, and TLS on top) takes several round trips. Keep-alive keeps a connection open after a response so the next request reuses it, which makes things much faster. HTTP/1.1 connections are kept alive by default. But idle connections cannot stay open forever, so somebody closes them: the client, a load balancer, or your server.
The Netty engine closes a connection that has been idle (no reads or writes) for idleTimeoutSeconds (60 by default; 0 never closes idle connections):
NettyHttpAdapter(8080, idleTimeoutSeconds = 120)The rule: let the balancer close first
Set the server's idle timeout longer than your load balancer's idle timeout (for example, AWS ALB closes idle connections after 60 s by default). Then the balancer closes the connection and knows it is closed. If your server closes first, the balancer may still believe the connection is open, send the next request on it, and get a reset: an intermittent 502 or "connection reset" that is hard to reproduce.
| Symptom | Likely cause |
|---|---|
| sporadic 502s through a balancer, nothing in the app logs | server idle timeout shorter than the balancer's |
| many connections stay open and use memory | idle timeout too long or 0 with many clients |
Check your platform's idle timeout (ALB, nginx keepalive_timeout, Kubernetes ingress) and set Kest above it.