Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[BUG] Continuous Redis Connection Error After Reconfiguring Credentials

Open amerkurev opened this issue 1 year ago • 1 comments

Describe the bug After reconfiguring Redis (deleting old credentials and creating new ones with the same settings), an error is continuously logged:


[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
   at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16)

[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
   at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16)

[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
   at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16)
...

To Reproduce Steps to reproduce the behavior:

  1. Create a working chatflow that uses Redis as Memory, similar to the screenshot below. Ensure that the Redis instance is "external" (e.g., in a neighboring container), and not local (127.0.0.1:6379).
  2. Go to the Credentials section, delete the existing Redis URL.
  3. Go back to your chatflow, save it, and send a message in the chat.
  4. Then, in the Credentials section, create a new Redis URL with the same settings as before.
  5. Navigate back to your chatflow, reconfigure the Redis node with the new credentials created in the Credentials section.
  6. Save the chatflow and send another message in the chat. Then open the flowise log, and you will see continuous errors like:

[ioredis] Unhandled error event: Error: connect ECONNREFUSED `127.0.0.1:6379
`  
   at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16)

Problem behavior Despite not using 127.0.0.1:6379 anywhere (we are using an "external" Redis instance), the connection attempts still target 127.0.0.1:6379. Moreover, the error continues to be logged infinitely, even after reconfiguring the Redis node. This issue persists until flowise is restarted.

Screenshots image image image image

Setup

  • Installation [docker]
  • Flowise Version [2.0.7]
  • OS: [Linux]

Additional context The issue might be related to the ioredis library's auto-reconnect logic, which by default, does not stop trying to reconnect. Here is an example from the ioredis documentation on how to control reconnection behavior with the retryStrategy option:

const redis = new Redis({
  // This is the default value of `retryStrategy`
  retryStrategy(times) {
    const delay = Math.min(times * 50, 2000);
    return delay;
  },
});

Please investigate why the connection still attempts to reach 127.0.0.1:6379 and why the error is persistently logged, even after reconfiguration.

amerkurev avatar Sep 13 '24 10:09 amerkurev

I have the same issue =(

asyrkovsky avatar Sep 13 '24 10:09 asyrkovsky

Yep, happening to us too

Zeouterlimits avatar Nov 20 '24 23:11 Zeouterlimits