The redis get calls sometimes fails with the following error. Once this happens, as a follow through, many of the requests fail/timeout intermittently with a 502 status.
{ Error: Redis connection to X.X.X.X:6379 failed - write ECONNRESET
at afterWriteDispatched (internal/stream_base_commons.js:78:25)
at writeGeneric (internal/stream_base_commons.js:73:3)
at Socket._writeGeneric (net.js:714:5)
at Socket._write (net.js:726:8)
at doWrite (_stream_writable.js:415:12)
at writeOrBuffer (_stream_writable.js:399:5)
at Socket.Writable.write (_stream_writable.js:299:11)
at RedisClient.write (/workspace/node_modules/redis/index.js:949:43)
at RedisClient.internal_send_command (/workspace/node_modules/redis/index.js:885:14)
at RedisClient.internal_send_command_trace [as internal_send_command] (/workspace/node_modules/@google-cloud/trace-agent/build/src/plugins/plugin-redis.js:91:50)
at RedisClient.get (/workspace/node_modules/redis/lib/commands.js:46:25)
at Promise (internal/util.js:274:30)
at new Promise (<anonymous>)
at RedisClient.get (internal/util.js:273:12)
at ConversationQueueServices.startTimeoutToClearQueueForVisitor (/workspace/ls/Services/ConversationQueueServices.js:306:57)
at PeoplesService.onVisitorSubscriberLeft (/workspace/ls/Services/PeoplesService.js:51:31)
at app.post (/workspace/app.js:196:27)
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at next (/workspace/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/workspace/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at /workspace/node_modules/express/lib/router/index.js:281:22 errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'write' }
From the looks of it, ECONNRESET indicates the connection is closed by redis instance. There is no surge of traffic of any sort. cpu, memory and number of connections are as usual.
Will moving to updated redis npm client may help? Currently using 3.0.2 redis client version
Any help is much appreciated. Thanks in advance.