ioredis icon indicating copy to clipboard operation
ioredis copied to clipboard

server crashes using cluster with shards - bug with ioredis 5.3.2

Open taltal78 opened this issue 2 years ago • 1 comments

Hi,

We are using ioredis(5.3.2) in our nodejs application. when we use the cluster with shards count 2, only in Azure the server crashes with the following trace: Exit status 1 at readableAddChunk (node:internal/streams/readable:297:9) at JavascriptRedisParser.returnError (/home/vcap/app/node_modules/ioredis/built/DataHandler.js:15:22) at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) at EventEmitter.handleReconnection (/home/vcap/app/node_modules/ioredis/built/Redis.js:509:30) at command.reject (/home/vcap/app/node_modules/ioredis/built/cluster/index.js:362:23) at DataHandler.returnError (/home/vcap/app/node_modules/ioredis/built/DataHandler.js:41:20) at TLSSocket.emit (node:events:513:28) at TLSSocket. (/home/vcap/app/node_modules/ioredis/built/DataHandler.js:25:20) at Readable.push (node:internal/streams/readable:234:10) at addChunk (node:internal/streams/readable:324:12) at JavascriptRedisParser.execute (/home/vcap/app/node_modules/redis-parser/lib/parser.js:542:14) at EventEmitter.handleError (/home/vcap/app/node_modules/ioredis/built/cluster/index.js:508:38) handlers.maxRedirections(new Error("Too many Cluster redirections. Last error: " + error)); Error: Too many Cluster redirections. Last error: ReplyError: MOVED 14861 10.160.128.51:15001 /home/vcap/app/node_modules/ioredis/built/cluster/index.js:508

we use following to connect: client = new Redis.Cluster(startupNodes, RedisClusterOptions); the options contains redisOptions with tls= {host: host, port: port}) and retryStrategy

and we also have error handler: client.on("error", (err) => {...

  1. Any idea what can cause this?
  2. Why is server crashes , altough we have error handler, and also try /catch in all our usages of the client. we use client.set , client.get , etc.

Thanks, Tal

taltal78 avatar Sep 18 '23 13:09 taltal78

Further internal analysis shown the following:

  1. Using ioredis 4.19.4 issue is not reproduced, so it seems like a regression.
  2. Using ioredis 5.3.2 and tls settings with digicert root ca --> issue solved and redis can be accessed redisOptions.tls = { ca: fs.readFileSync(${__dirname}/cert.pem, 'utf-8'), rejectUnauthorized: false }; cert.pem from here: https://cacerts.digicert.com/DigiCertGlobalRootG2.crt.pem

taltal78 avatar Sep 19 '23 09:09 taltal78