server crashes using cluster with shards - bug with ioredis 5.3.2
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.
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) => {...
- Any idea what can cause this?
- 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
Further internal analysis shown the following:
- Using ioredis 4.19.4 issue is not reproduced, so it seems like a regression.
- 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