redis / ioredis

🚀 A robust, performance-focused, and full-featured Redis client for Node.js.
MIT License
14.07k stars 1.19k forks source link

Redis connection get stuck forever while issuing XADD commands #1821

Open Hackatosh opened 9 months ago

Hackatosh commented 9 months ago

Hello !

On our production environnement, we have a process that regularly polls data from a database and put the data inside Redis Streams using XADD commands (we use a transactionnal outbox pattern). In some case, this process seems to get stuck. We suspect that the process get stuck while issuing the XADD commands.

Redis version : 6.2.12 ioredis version : 5.3.2 NodeJS version : 18.15.0

Settings of our ioredis connection includes :

retryStrategy: Math.min(times * 200, 2000) is returned unless we have reached the maximum number of tries. In this case null is returned
maxRetriesPerRequest: null
enableReadyCheck: false
reconnectOnError: false
keepAlive: 1000

Do you have any ideas how we can solve this issue ?

shivanshtalwar commented 8 months ago

@Hackatosh maybe try creating seperate redis connection while calling xadd using connection.duplicate().xadd() It works for me

Hackatosh commented 6 months ago

@shivanshtalwar I don't think it will be acceptable for performance : each time we will push data to redis streams, we will need to open a new connection. We need to have something very fast for our outbox