Interview Prep/Networking/Sockets, ports, TIME_WAIT and conntrack

The app logs `write: broken pipe` (or `EPIPE`) on some responses.

BeginnerTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer

Likely causes → The app wrote to a socket the peer had already closed: the client gave up (timeout, user navigated away), or a proxy/LB in between closed the connection because its timeout was shorter than the app's processing time.

Diagnose →

# correlate with proxy logs: nginx 499 or ALB 460 at the same timestamps
grep ' 499 ' /var/log/nginx/access.log | tail

Measure how long the failing requests took versus each layer's timeout.

Fix → Occasional EPIPE from impatient clients is normal; log it at a lower level. If it correlates with slow endpoints, speed them up or align timeouts so each inner layer times out before the outer one.

Prevent → Define a timeout budget from client → LB → proxy → app → DB, decreasing at each hop.

All Networking questions Roadmap: Networking for DevOps

More on Sockets, ports, TIME_WAIT and conntrack