During a rolling binary upgrade with `SO_REUSEPORT`, a fraction of requests still hit the old version and some get reset.
AdvancedTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer
Likely causes → With SO_REUSEPORT the kernel hashes new connections across all listening sockets in the group. While the old process is alive, it keeps receiving new connections. When it exits, connections already sitting in its accept queue (handshake complete, not yet accepted) are reset.
Diagnose →
sudo ss -ltnp 'sport = :8080' # two PIDs listening on the same port
nstat -az TcpExtTCPAbortOnClose
Fix → Stop the old process's listener before it exits: close the listening socket, keep serving in-flight requests, then exit (graceful drain). Tools like nginx (nginx -s reload), HAProxy (-x socket transfer / seamless reload) and Envoy hot restart pass the listening FD instead of racing.
Prevent → Use FD passing / socket activation (systemd) for zero-downtime restarts, and test upgrades under load.
More on Sockets, ports, TIME_WAIT and conntrack
`dmesg` is full of `nf_conntrack: nf_conntrack: table full, dropping packet` and new connections randomly time out.Intermediate`ss -s` on a reverse proxy shows 40,000 sockets in `TIME_WAIT`. Is that a problem?BeginnerAn app server's `CLOSE_WAIT` count grows steadily until the service logs `Too many open files`.IntermediateLogs show `accept4(): Too many open files` and the service stops accepting connections.Beginner`dmesg` shows `TCP: request_sock_TCP: Possible SYN flooding on port 443. Sending cookies.`Intermediate`ss -ltn` shows the listener for port 8080 with `Recv-Q 129` and `Send-Q 128`, and clients hang on connect.Advanced