-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refreshing slots cache infinite loop issue #1766
Comments
As it turns out, we get the host and port information through the CLUSTER SLOTS command, but ElastiCache is not resetting correctly and disconnecting because host is a domain address.
|
If you change the host value in lib/cluster/index.ts on line 863 to get the IP value first if there is an IP value, the above infinite loop problem will be solved. for (let i = 0; i < result.length; ++i) {
const items = result[i];
const slotRangeStart = items[0];
const slotRangeEnd = items[1];
const keys = [];
for (let j = 2; j < items.length; j++) {
if (!items[j][0]) {
continue;
}
this.options.natMap[`${items[j][0]}:${items[j][1]}`] = {
host: items[j][3]?.[1] as string ?? items[j][0],
port: items[j][1]
}
const node = this.natMapper({
host: items[j][0],
port: items[j][1],
});
node.readOnly = j !== 2;
nodes.push(node);
keys.push(node.host + ":" + node.port);
} |
Here is a sample of the output when calling the CLUSTER SLOTS command in ElastiCache.
|
Removing host and port from the tls attribute in the cluster constructor options eliminated the reset infinite loop issue. We need to find the cause of this symptom. this._client = new Redis.Cluster([{
host,
port
}], {
scaleReads: 'slave',
maxRedirections: envManager.atcsRedisClusterMaxRedirections,
retryDelayOnMoved: 100,
redisOptions: {
username: user,
password,
tls: isLocalEnv ? undefined : {
rejectUnauthorized: false
}
}
}) |
Environment
Symptoms
When I call any command through the ioredis library, it throws a MOVED error, performs a refreshing slot cache, and succeeds in getting the correct cluster slot information. However, in the reset part, it is not reset correctly, causing a loop in the refreshing slot cache operation.
If the loop continues like that and exceeds the maximum number of times specified in the options, it will exit with a 'Too Many Redirections' error.
Redis Cluster Setup
ioredis debug log
Is anyone else experiencing similar symptoms to me?
The text was updated successfully, but these errors were encountered: