Connection is Closed
See original GitHub issueioRedis@4.9.0 Redis Server Version: 5 Using Redis sentinel on production.
Error: Connection is closed. at Redis.sendCommand (/nodeApi/node_modules/ioredis/built/redis.js:552:24)
I have specified the retryStragey, which is working if any redis node(master) goes down and I am assuming it should work for this case too. Or do I need to specify some other option?
var redis = require('ioredis'),
client = Promise.promisifyAll(redis.createClient( {
sentinels: config.redis.endpoints,
name: config.redis.masterName,
prefix: config.database.redisPrefix,
pass: config.database.redisPassword,
role:"slave",
retry_strategy: function (options) {
if (options.error.code === 'ECONNREFUSED') {
// End reconnecting on a specific error and flush all commands with a individual error
return new Error('The server refused the connection');
}
if (options.total_retry_time > 1000 * 60 * 60) {
// End reconnecting after a specific timeout and flush all commands with a individual error
return new Error('Retry time exhausted');
}
if (options.times_connected > 10) {
// End reconnecting with built in error
return undefined;
}
// reconnect after
return Math.max(options.attempt * 100, 500);
}
})),
client.on("error", function (err) {
console.log("Error " + err);
});
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
java.sql.SQLException: Connection is closed - Stack Overflow
You might have called for closeConnection() method after select statement.So an exception is thrown at runtime when it tried to execute the ...
Read more >How to deal with closed connections in database pool
This article explains how to overcome the "connection is closed" error that sometimes is seen on the mule logs when connecting to a...
Read more >Cause: java.sql.SQLException: Connection is closed - Flowable
My Sprin Boot Application got exception which is “Cause: java.sql.SQLException: Connection is closed”,I think this is the same problem to ...
Read more >How To Fix "ERR_CONNECTION_CLOSED" in Chrome (13 ...
The ERR_CONNECTION_CLOSED message is essentially telling you that Chrome tried to make this connection, but something went wrong with your ...
Read more >Handling java.sql.SQLRecoverableException: Closed ...
This error message indicates that the connection used by the backup task (or any other long-running operation that relies on a single database ......
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
Just set
retryStrategy
tonull
will do the trick:@gajus Actually it’s documented https://github.com/luin/ioredis#auto-reconnect, but in another format:
So besides
retryStrategy: null
, you can also writeretryStrategy() { return false }
. The documentation needs a restructure anyway as it becomes too long to read.