ECONNABORTED
Linux / POSIXERRORNotableNetworkHIGH confidence

Software Caused Connection Abort

Production Risk

Non-fatal; always retry accept() on ECONNABORTED.

What this means

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).

Why it happens
  1. 1Client sends RST immediately after SYN-ACK (rapid connect/disconnect)
  2. 2accept() called on a connection that was aborted in the backlog queue
  3. 3Firewall or OS aborted the connection before accept() could process it
How to reproduce

accept() when a client aborts the connection before it is accepted.

trigger — this will error
trigger — this will error
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

Retry accept() after ECONNABORTED
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.

What not to do

Treat ECONNABORTED as a fatal server error

It only means one client aborted; the listening socket is still valid — just retry accept().

Sources
Official documentation ↗

Linux Programmer Manual accept(2)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors