Skip to content

Conversation

utsav-bx
Copy link

Problem

Fixes #5126 - Flowise hangs indefinitely when Redis connections drop, causing ECONNRESET errors during queue processing.

Solution

Adds Redis connection resilience configuration via environment variables:

  • REDIS_CONNECT_TIMEOUT=10000 - Connection timeout (ms)
  • REDIS_COMMAND_TIMEOUT=30000 - Command timeout (ms) - prevents waitUntilFinished() hanging
  • REDIS_MAX_RETRIES_PER_REQUEST=3 - Retry attempts
  • REDIS_LAZY_CONNECT=true - Connect on demand
  • REDIS_KEEPALIVE_INTERVAL=30000 - Keep-alive interval (ms)

Key Changes

  • Enhanced packages/server/src/queue/QueueManager.ts with IORedis timeout/retry settings
  • Updated packages/server/.env.example with new Redis configuration options
  • Maintains full backward compatibility with existing Redis environment variables

Testing

  • ✅ Build passes with pnpm build
  • ✅ TypeScript compilation successful
  • ✅ All existing Redis env vars preserved

- Add Redis timeout and retry configuration via environment variables
- Fix waitUntilFinished() hanging indefinitely on Redis connection drops
- Add connectTimeout, commandTimeout, maxRetriesPerRequest settings
- Maintain backward compatibility with existing Redis env vars
- Resolves issue FlowiseAI#5126

Breaking change: None
const QUEUE_NAME = process.env.QUEUE_NAME || 'flowise-queue'

// Redis resilience configuration with environment variable support
const REDIS_CONNECT_TIMEOUT = process.env.REDIS_CONNECT_TIMEOUT ? parseInt(process.env.REDIS_CONNECT_TIMEOUT, 10) : 10000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to hardcode a default value for these.

If these are set, we only pass it in, if not, we leave it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redis connection failures cause indefinite blocking in queue mode with no timeout or recovery mechanism
2 participants