weyoss / redis-smq

A simple high-performance Redis message queue for Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Managed redis connection keeps throwing error

vizsatiz opened this issue · 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
  ]
}
commented

@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.

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

Starting with redis-smq@8.0.0-rc.20 errors handling for async callbacks has been reworked.