1
votes

I use Google Cloud Run with Google Memorystore Redis. My application is written on Node.js (Express) and connected to the Redis Instance in this way:

const asyncRedis = require("async-redis");
const redisClient = asyncRedis.createClient(process.env.REDISPORT, String(process.env.REDISHOST));
redisClient.on('error', (err) => console.error('ERR:REDIS:', err));
.....
const value = await redisClient.get("Code");

Every half an hour the application loses its connection to the Redis and I receive the error:

AbortError: Redis connection lost and command aborted. It might have been processed.
at RedisClient.flush_and_error (/usr/src/app/node_modules/redis/index.js:362)
at RedisClient.connection_gone (/usr/src/app/node_modules/redis/index.js:664)
at RedisClient.on_error (/usr/src/app/node_modules/redis/index.js:410)
at Socket.<anonymous> (/usr/src/app/node_modules/redis/index.js:279)
at Socket.emit (events.js:315)
at emitErrorNT (internal/streams/destroy.js:92)
at emitErrorAndCloseNT (internal/streams/destroy.js:60)
at processTicksAndRejections (internal/process/task_queues.js:84)

In two or three minutes the connection returns and the application works correctly during half an hour until next disconnect.

Any idea?

1
Hi, I'm having same issue... I have different projects within Cloud Run.. each connects to a different redis instance ( different VM with different cpu and memory)... The funny part is that errors occurs ~ once a week and all services fail around same hour... it seem to me that gcloud is having some kind of network cleanup window. Any updates?David Valdivieso

1 Answers

1
votes

According to the official GCP documentation there can be several scenarios that could cause the connectivity issues with your Redis instance. However, as the connectivity issues you are experiencing are intermittent and normally you connect to the instance successfully, none of the mentioned scenarios seems to be applicable to your situation.

There is a similar issue opened on GitHub, where some users where experiencing it when reaching the maximum number of clients for their Redis instance, however, I would recommend you to contact the GCP technical support, so that they could review your particular configuration and inspect your instance with the internal tools.