Skip to content

Workflows execute 3 times instead of 1 in Queue Mode (v1.95.1) - All instances (main & workers) start active workflows #15878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
taycancoder opened this issue May 31, 2025 · 1 comment
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@taycancoder
Copy link

Bug Description

In a Docker Compose setup with one main n8n instance and two worker instances configured for queue mode, all three instances (main, worker-1, and worker-2) are logging "Start Active Workflows:" and listing all active workflows. This leads to workflows being triggered or processed multiple times (seemingly three times, once by each instance). The worker instances are not correctly deferring workflow activation to the main instance, despite appropriate environment variable settings. This behavior was observed in v1.94.1 and persists after upgrading to v1.95.1.

To Reproduce

Steps to reproduce the behavior:
Set up a Docker Compose environment with one n8n main instance and at least one n8n worker instance (e.g., n8n-worker-1).
Configure all instances for queue mode using Redis, with the following key environment variables:
Main instance (n8n):
N8N_PROCESS=main
EXECUTIONS_MODE=queue
N8N_DISABLE_ACTIVE_WORKFLOWS=false
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true
(Relevant QUEUE_BULL_REDIS_* variables)
Worker instance(s) (n8n-worker-1, n8n-worker-2):
N8N_PROCESS=worker
EXECUTIONS_MODE=queue
N8N_DISABLE_ACTIVE_WORKFLOWS=true
(Relevant QUEUE_BULL_REDIS_* variables)
N8N_SKIP_WEBHOOK_REGISTRATION_ON_STARTUP=true
N8N_SKIP_WEBHOOK_DEREGISTRATION_SHUTDOWN=true
Start the Docker Compose stack (docker-compose up -d).
Observe the logs for the main n8n container and the n8n-worker-1 (and any other worker) containers.
See error: All instances (main and workers) will output the "Start Active Workflows:" banner and list all active workflows. Any trigger (e.g., a cron, webhook, or manual execution) will likely result in the workflow being processed by all three instances.

Expected behavior

Only the main n8n instance (configured with N8N_PROCESS=main and N8N_DISABLE_ACTIVE_WORKFLOWS=false) should log "Start Active Workflows:" and be responsible for activating/scheduling workflows.
Worker instances (configured with N8N_PROCESS=worker and N8N_DISABLE_ACTIVE_WORKFLOWS=true) should not log "Start Active Workflows:" and should only pick up and process jobs from the Redis queue. Workflows should only execute once, processed by an available worker.

docker-compose_lastQueue_31-05.yml.txt

code (5).txt
code (4).txt
code (3).txt

Operating System

Ubuntu 24

n8n Version

1.95.1

Node.js Version

18.13

Database

PostgreSQL

Execution mode

queue

@Joffcom
Copy link
Member

Joffcom commented May 31, 2025

Hey @taycancoder,

We have created an internal ticket to look into this which we will be tracking as "GHC-2271"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants