redis-smq icon indicating copy to clipboard operation
redis-smq copied to clipboard

Managed redis connection keeps throwing error

Open vizsatiz opened this issue 1 year ago • 3 comments

I am using a managed redis instance with Digitial ocean. When I used redis-smq with node redis, the connection often crashes the server.

I dont seem to have a good way to catch this exception too

/app/node_modules/redis-smq/dist/src/lib/base.js:99
            throw err;
            ^
AbortError: Redis connection lost and command aborted. It might have been processed.
    at RedisClient.flush_and_error (/app/node_modules/redis-smq-common/node_modules/redis/index.js:298:23)
    at RedisClient.connection_gone (/app/node_modules/redis-smq-common/node_modules/redis/index.js:603:14)
    at TLSSocket.<anonymous> (/app/node_modules/redis-smq-common/node_modules/redis/index.js:231:14)
    at Object.onceWrapper (node:events:513:28)
    at TLSSocket.emit (node:events:406:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'UNCERTAIN_STATE',
  command: 'BRPOPLPUSH',
  args: [
    'redis-smq-v7.1:alpha:1:q_artoo_main_v1',
    'redis-smq-v7.1:alpha:5:q_artoo_main_v1:a365cb01-5362-4223-8ab3-a7f6b8d76f39',
    0
  ]
}

vizsatiz avatar Jul 18 '23 03:07 vizsatiz

@vizsatiz Thank you for reporting this issue.

The error message says "Redis connection lost and command aborted. It might have been processed". I believed that this issue is not related to RedisSMQ itself but to the environment from which the message queue is running.

If you still think that this error comes from the MQ please provide the steps required to reproduced it.

weyoss avatar Aug 04 '23 17:08 weyoss

Hey @weyoss, I understand that Redis connection error has more to do with the Redis server, than redis-smq, but since the error is happening inside the redis-smq-common lib, and I do not have any handle to access the connection object, I do not have a graceful way to handle this scenario, and stop my app from crashing

Since the redis-smq interface doesn't let me handle the connection myself and just pass the connection object in, it becomes difficult to fix the connection or take necessary steps when the connection is lost.

So my suggestion would be to create a mechanism to gracefully handle such connection issues

vizsatiz avatar Aug 04 '23 17:08 vizsatiz

Starting with [email protected] errors handling for async callbacks has been reworked.

weyoss avatar Mar 26 '24 00:03 weyoss