LightAtom

"Connection Reset by Peer": Causes and Fixes

The remote side (or a device in between) sent a TCP reset that killed the connection. Common with idle timeouts, crashes, overloaded servers and firewalls.

Connection reset by peer

The computer at the other end, or a firewall or load balancer between you, abruptly aborted the connection with a reset packet.

Quick checks

  • Does it happen after a period of inactivity? That's an idle timeout.
  • Does it happen on large transfers? Look at MTU or server limits.
  • Try another network or turn off the VPN.

Fixes on Mac

  1. SSH sessions that drop when idle

    1. Add to ~/.ssh/config: ServerAliveInterval 60 and ServerAliveCountMax 3, so the session sends keep-alives through NAT and firewalls.
  2. Node.js (ECONNRESET)

    1. Retry idempotent requests with backoff.
    2. Mismatched keep-alive timeouts are common: make the client's idle socket timeout shorter than the server's, so the client never reuses a socket the server just closed.
  3. Check MTU on VPNs

    1. If large transfers reset but small ones work, lower the MTU (System Settings › Network › Details › Hardware) and test.

Fixes on Windows

  1. Windows

    1. Check antivirus network protection and VPN clients; reset Winsock if resets happen everywhere.

Other devices

  1. Servers

    1. Check server logs for crashes or limits (max connections, request size, timeouts) at the time of the reset.

Still not working?

Broken pipe is the mirror image: your program wrote to a connection the other side had already closed. The fixes are the same: keep-alives, sensible timeouts and retries.

See what’s happening

LightAtom's connections view shows long-lived connections from your apps and when they disappear.

Frequently asked questions

What does “connection reset by peer” mean?

The remote end sent a TCP RST, ending the connection immediately, because the server process closed, crashed, timed out the connection, or a middlebox killed it.

What is ECONNRESET in Node.js?

Node's error code for a connection reset by the other side. It often happens when reusing a keep-alive socket the server had already closed.

What causes “broken pipe”?

Writing to a socket after the other side closed it. Idle timeouts and server restarts are common triggers.

LightAtom team

The people who build LightAtom, a network monitor for macOS.