Auto reconnect doesn't work under certains circumstances
See original GitHub issueHello,
When ready check is on and an MaxRetriesPerRequestError happens, a recoverFromFatalError is called in the ready check causing disconnect(true) to be called and will lead to abort to reconnection process.
This is leading us in a situation where express session associated to redisStore isn’t working anymore.
a quick and dirty fix for us is to disable ready check or set MaxRetriesPerRequest to -1
Our case to test the bug:
ioredis express client connected as a standalone redis configuration to redis-ha chart with haproxy enabled and 3 redis/sentinel behind. (haproxy is routing all requests to the master node) kill or scale to 0 haproxy. ioredis is entering the autoreconnect loop (with retrystrategy)
Adding this stack to help :
programname programname 2019-11-20T08:58:29.197Z ioredis:redis status[10.19.246.167:6379 (clientname)]: close -> reconnecting
programname programname 2019-11-20T08:58:29.197Z ioredis:connection reach maxRetriesPerRequest limitation, flushing command queue... v1
programname programname 2019-11-20T08:58:29.197Z ioredis:connection reach maxRetriesPerRequest limitation, flushing command queue... DONE v1
programname programname 2019-11-20T08:58:29.197Z ioredis:redis recoverFromFatalError MaxRetriesPerRequestError: Reached the max retries per request limit (which is 1). Refer to "maxRetriesPerRequest" option for details.
programname programname 2019-11-20T08:58:29.198Z ioredis:redis DISCONNECT CALLED v2 true
programname programname Trace
programname programname at Redis.disconnect (/snapshot/programname/node_modules/ioredis/built/redis/index.js:323:10)
programname programname at Redis.recoverFromFatalError (/snapshot/programname/node_modules/ioredis/built/redis/index.js:365:10)
programname programname at /snapshot/programname/node_modules/ioredis/built/redis/event_handler.js:53:30
programname programname at /snapshot/programname/node_modules/ioredis/built/redis/index.js:436:20
programname programname at tryCatcher (/snapshot/programname/node_modules/standard-as-callback/built/utils.js:11:23)
programname programname at promise.then (/snapshot/programname/node_modules/standard-as-callback/built/index.js:30:51)
programname programname at process._tickCallback (internal/process/next_tick.js:68:7)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:9
Top Results From Across the Web
Android 11 lets you not automatically connect to specific Wi-Fi ...
Android 11 has a new toggle in the settings panel for Wi-Fi networks called 'Auto-connect,' and when it is switched off, your device...
Read more >[SOLVED] Reconnect ESP8266 NodeMCU to Wi-Fi Network ...
To reconnect to Wi-Fi after a connection is lost, you can use WiFi.setAutoReconnect(true); followed by WiFi.persistent(true); to automatically reconnect to the ...
Read more >Fix: Windows 10 will not connect to WIFI Automatically - Appuals
Then from under Manage Known Networks, Click the name of your wireless network and choose Forget. Restart your computer. Click on the WiFi...
Read more >Mongoose autoReconnect option - node.js - Stack Overflow
I'm attaching that event to the return of this createConnection() call. My events are working normally with the connected / disconnected events. –...
Read more >iPhone Won't Auto-Connect to WiFi – How to Fix - Alphr
Naturally, the first thing you should try is restarting your Wi-Fi connection. Turn your Wi-Fi off and on in the Settings app or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
reproduced method:
redis-server
not startednew Redis()
and call any command, e.g.get
ioredis
will connect failed and retry(enable DEBUG and printretryAttempts
)retryAttempts
reach20
, start netcatnc -l 6379
as a fakeredis-server
ioredis
connected to netcat andinfo
command written, stop netcatreconnectTimeout
task would always canceled byrecoverFromFatalError
get
command will never returnThe error still here, even with the version 4.17.3…