I need held redis queue

My config file pm2

module.exports = {
  apps: [
    {
      name: 'n8n-main',
      script: 'n8n',
      args: '',
      instances: 1,
      exec_mode: 'fork',
      env: {
        NODE_ENV: 'production',
        N8N_PORT: 5678,
        EXECUTIONS_MODE: 'queue',
        N8N_SECURE_COOKIE: 'false',
        // Redis configuration
        QUEUE_BULL_REDIS_HOST: 'localhost',
        QUEUE_BULL_REDIS_PORT: 6379,
        QUEUE_BULL_REDIS_DB: 0,

        // Database

        DB_TYPE: 'postgresdb',
        DB_POSTGRESDB_HOST: 'localhost',
        DB_POSTGRESDB_PORT: 5432,
        DB_POSTGRESDB_DATABASE: 'n8n',
        DB_POSTGRESDB_USER: 'n8n_user',
        DB_POSTGRESDB_PASSWORD: 'MonMotDePasseSecurise123!',

        // Encryption key
        N8N_ENCRYPTION_KEY: 'vGluJdTZ1rWDnytZT3X7D02l33OQ13aE'
      }
    },
    {
      name: 'n8n-worker',
      script: 'bash',
      args: '-c "sleep 5 && n8n worker --concurrency=1"',
      instances: 1,
      exec_mode: 'fork',
      env: {
        NODE_ENV: 'production',
        EXECUTIONS_MODE: 'queue',

        // Redis configuration
        QUEUE_BULL_REDIS_HOST: 'localhost',
        QUEUE_BULL_REDIS_PORT: 6379,
        QUEUE_BULL_REDIS_DB: 0,

        // Database
        DB_TYPE: 'postgresdb',
        DB_POSTGRESDB_HOST: 'localhost',
        DB_POSTGRESDB_PORT: 5432,
        DB_POSTGRESDB_DATABASE: 'n8n',
        DB_POSTGRESDB_USER: 'n8n_user',
        DB_POSTGRESDB_PASSWORD: 'MonMotDePasseSecurise123!',

        // Encryption key
        N8N_ENCRYPTION_KEY: 'vGluJdTZ1rWDnytZT3X7D02l33OQ13aE'
      }
    }
  ]
};

i have this error, whereas i run pm2 logs :
1|n8n-worker | n8n Task Broker’s port 5679 is already in use. Do you have another instance of n8n running already?
PM2 | App [n8n-worker:1] exited with code [1] via signal [SIGINT]
PM2 | App [n8n-worker:1] starting in -fork mode-
PM2 | App [n8n-worker:1] online
1|n8n-worker | Last session crashed

and i don’t understand why :

just with this workflow
My workflow(5).json (1.6 KB)

i don’t understand why,

Thanks for your answer, but now I have another problem. I have this workflow:


a scheduler set to 10 seconds and a wait of 2 seconds.

I don’t understand why, when I run it, it creates lots of workflows in the queue.

my pm2 config

cat ecosystem.support.config.js
module.exports = {
  apps: [
    {
      name: 'n8n-main',
      script: 'n8n',
      args: '',
      instances: 1,
      exec_mode: 'fork',
      env: {
        NODE_ENV: 'production',
        N8N_PORT: 5678,
        EXECUTIONS_MODE: 'queue',
        N8N_SECURE_COOKIE: 'false',

        // Redis configuration
        QUEUE_BULL_REDIS_HOST: 'localhost',
        QUEUE_BULL_REDIS_PORT: 6379,
        QUEUE_BULL_REDIS_DB: 0,

        // Database
        DB_TYPE: 'postgresdb',
        DB_POSTGRESDB_HOST: 'localhost',
        DB_POSTGRESDB_PORT: 5432,
        DB_POSTGRESDB_DATABASE: 'n8n',
        DB_POSTGRESDB_USER: 'n8n_user',
        DB_POSTGRESDB_PASSWORD: 'MonMotDePasseSecurise123!',

        // Encryption key
        N8N_ENCRYPTION_KEY: 'vGluJdTZ1rWDnytZT3X7D02l33OQ13aE'
      }
    },
    {
      name: 'n8n-worker',
      script: 'bash',
      args: '',
      instances: 1,
      exec_mode: 'fork',
      env: {
        NODE_ENV: 'production',
        EXECUTIONS_MODE: 'queue',


        // DÉSACTIVER les Task Runners sur le worker (solution du support)
        N8N_RUNNERS_ENABLED: 'false',
        N8N_CONCURRENCY_PRODUCTION_LIMIT: 1,

        // Redis configuration
        QUEUE_BULL_REDIS_HOST: 'localhost',
        QUEUE_BULL_REDIS_PORT: 6379,
        QUEUE_BULL_REDIS_DB: 0,

        // Database
        DB_TYPE: 'postgresdb',
        DB_POSTGRESDB_HOST: 'localhost',
        DB_POSTGRESDB_PORT: 5432,
        DB_POSTGRESDB_DATABASE: 'n8n',
        DB_POSTGRESDB_USER: 'n8n_user',
        DB_POSTGRESDB_PASSWORD: 'MonMotDePasseSecurise123!',

        // Encryption key
        N8N_ENCRYPTION_KEY: 'vGluJdTZ1rWDnytZT3X7D02l33OQ13aE'
      }
    }
  ]
};

@Necroun What i have found is:

Your workflow is waiting to be executed as you are using EXECUTIONS_MODE=queue which needs separate worker processes to execute the jobs. The PM2 configuration you are currently using only starts up the main n8n process, which only schedules the triggers but does not process the queue.

We can repair it as such

Solution 1 Recommended: Add a Worker Process
Make changes to ecosystem.config.js to start main and worker processes.
javascript.
module.exports = {
apps: [
{
name: ‘n8n-main’,
script: ‘n8n’,
args: ‘’,
instances: 1,
exec_mode: ‘fork’,
env: {
NODE_ENV: ‘production’,
N8N_PORT: 5678,
EXECUTIONS_MODE: ‘queue’,
// … keep your other env variables.
}
},
{
name: ‘n8n-worker’,
script: ‘n8n’,
args: ‘worker’,
instances: 1, // Increase this number for more parallel workers.
exec_mode: ‘fork’,
env: {
NODE_ENV: ‘production’,
// Worker needs the SAME database and Redis config.
DB_TYPE: ‘postgresdb’,
DB_POSTGRESDB_HOST: ‘localhost’,
// … COPY ALL YOUR DATABASE & REDIS VARIABLES HERE.
}.
}.
].
};
}.

Then restart with `pm2 restart all`.

Shift Back to Pre-Installed – More Convenient!
If parallel execution is not required, modify your main process environment to.
`env`
EXECUTIONS_MODE=regular.
```.
Take out the laborer. This will execute workflows immediately in the primary process.

Reason of this occurrence. When the queue mode is active, the main process will push executions into Redis Redis is polled and run by workers (the n8n worker command). Without workers, executions pile up endlessly.

You should see your scheduler working correctly now.

All though i recommend posting this question of yours into a separate thread.

1 Like