Software Caused Connection Abort
Production Risk
Non-fatal; always retry accept() on ECONNABORTED.
ECONNABORTED (errno 103) is returned by accept() when a connection was established and then immediately aborted by the client (RST received before accept() returned the connection).
- 1Client sends RST immediately after SYN-ACK (rapid connect/disconnect)
- 2accept() called on a connection that was aborted in the backlog queue
- 3Firewall or OS aborted the connection before accept() could process it
accept() when a client aborts the connection before it is accepted.
int client = accept(listenfd, NULL, NULL); // Returns -1, errno = ECONNABORTED if connection was aborted
expected output
accept: Software caused connection abort (ECONNABORTED)
Fix
Retry accept() after ECONNABORTED
WHEN In the accept() loop of a server
for (;;) {
int client = accept(listenfd, NULL, NULL);
if (client == -1) {
if (errno == ECONNABORTED) continue; // Client aborted — retry
if (errno == EINTR) continue; // Signal — retry
break; // Fatal error
}
// Handle client
}Why this works
ECONNABORTED means a client connection was abandoned; simply retry accept() to get the next connection.
✕ Treat ECONNABORTED as a fatal server error
It only means one client aborted; the listening socket is still valid — just retry accept().
Linux Programmer Manual accept(2)
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev