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.
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 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
timeoutsetting closing idle clients - Client without keepalive
- Network blips/failover
- Long-idle pooled connections
⚡ Quick fix
- Enable TCP keepalive in the client (e.g. ioredis
keepAlive: 10000, redis-pyhealth_check_interval=30) - Set Redis
timeout 0andtcp-keepalive 60 - Add retry/reconnect strategy
Detailed fix by platform
Python
redis.Redis(host="...", socket_keepalive=True, health_check_interval=30)
How to diagnose
- Idle — Time before error?
- Network — NAT/LB timeout?
- 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:
Similar errors
- ActiveRecord::ConnectionNotEstablished Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found
- 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
- 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
Most viewed in Redis
- READONLY You can't write against a read only replica Redis: READONLY You can't write against a read only replica
- MISCONF Redis: MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk
- OOM command not allowed Redis: OOM command not allowed when used memory > 'maxmemory'
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 5 Nov 2026