ECONNRESET / Connection reset by peer on idle Redis connection Redis Origin: Data Last updated 5 Nov 2026

Redis: Error: read ECONNRESET / redis.exceptions.ConnectionError: Connection reset by peer after idle time

A middlebox or Redis closed an idle connection, and the pooled client reused it.

Exact message you may see Error: read ECONNRESET redisredis.exceptions.ConnectionError: Connection reset by peerError: Connection is closed. ioredisredis.exceptions.ConnectionError: Error while reading from socket: (104, 'Connection reset by peer')ReplyError: Connection reset by peer Redis
Seen on: Redis Node.js

Meaning

Set timeout 0 (or a larger value) in Redis, enable client keepalive/pings (keepAlive, socket_keepalive, health_check_interval=30 in redis-py), and let the client reconnect with retry. Cloud load balancers/NAT drop idle TCP connections after ~4-10 min (Azure 4 min, AWS NLB 350 s).

Common causes

  • Idle timeout on NAT/load balancer
  • Redis timeout setting closing idle clients
  • Client without keepalive
  • Network blips/failover
  • Long-idle pooled connections

⚡ Quick fix

  1. Enable TCP keepalive in the client (e.g. ioredis keepAlive: 10000, redis-py health_check_interval=30)
  2. Set Redis timeout 0 and tcp-keepalive 60
  3. Add retry/reconnect strategy

Detailed fix by platform

Python

  1. redis.Redis(host="...", socket_keepalive=True, health_check_interval=30)

How to diagnose

  1. Idle — Time before error?
  2. Network — NAT/LB timeout?
  3. Client — keepalive set?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

ActiveRecord::ConnectionNotEstablished — Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found (Ruby / Rails)ActiveRecord::Connect…BullMQ: Missing lock for job / job stalled more than allowable limit — BullMQ: Error: Missing lock for job 42. moveToFinished / job stalled more than allowable limit (Redis)BullMQ: Missing lock …BUSY Redis is busy running a script — Redis: (error) BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE (Redis)BUSY Redis is busy ru…Celery with Redis: tasks run twice (visibility_timeout) — Celery: Task executed twice / Restoring unacked messages — Redis broker visibility_timeout shorter than task ETA (Redis)Celery with Redis: ta…Client output buffer limit reached (scheduled to be closed) — Redis: Client id=12 addr=10.0.0.5:51234 scheduled to be closed ASAP for overcoming of output buffer limits (Redis)Client output buffer …ClientClosedError: The client is closed (node-redis v4) — node-redis: ClientClosedError: The client is closed (Redis)ClientClosedError: Th…ERR max number of clients reached — Redis: ERR max number of clients reached (Redis)ERR max number of cli…Error: connect ECONNREFUSED 127.0.0.1:6379 — Redis: Error: connect ECONNREFUSED 127.0.0.1:6379 / Could not connect to Redis at 127.0.0.1:6379: Connection refused (Redis)Error: connect ECONNR…ECONNRESE…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.