The occasional ECONNRESET
The article discusses a technical issue involving a TCP connection reset error, known as ECONNRESET, occurring between two services on the same machine. The author provides a detailed examination of the behavior of both the server and client during data transmission, highlighting the conditions under which the error arises. The article sets the stage for further exploration of the issue in a subsequent part.
- ▪Two services are running on the same machine, with one opening a listening TCP socket and the other connecting to it.
- ▪The client experiences an ECONNRESET error while trying to read data from the socket, despite no other errors being logged.
- ▪The issue appears to be triggered when the client sends data to the server before attempting to receive data.
Opening excerpt (first ~120 words) tap to expand
blog - git - desktop - contact The occasional ECONNRESET (part 1/2) 2026-05-05 Two services running on the same machine. One of them opens a listening TCP socket bound to localhost, the other one connects to that. They exchange data. Every now and then, the service that initiated the connection gets an ECONNRESET while reading data from the socket -- but no other errors show up in the logs, no crashes, nothing. What's going on? A reproducer in the "lab" What tcpdump sees What strace ./server sees What strace ./client --spam sees A first hypothesis The real-life scenario Next steps Go on to part 2. A reproducer in the "lab" Let's start with the "server", i.e. the service that opens the listening socket.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Movq.