External Redis "Queue" mode "Possible n8n bug?"

n8n queue mode: PostgreSQL connection timeouts after switching from in-cluster Redis to external Aiven Valkey

Describe the problem/error/question

Summary
After migrating Redis from an in-cluster deployment to external Aiven Valkey, n8n started failing executions with PostgreSQL connection timeouts.
Before the Redis migration, the same deployment worked correctly. (task is not picking up by worked )
Environment

  • n8n deployed via Helm chart
  • Kubernetes cluster
  • Queue mode enabled
  • PostgreSQL running in-cluster
  • Redis migrated from in-cluster Redis to external Aiven Valkey
    anton% kubectl get pods -n n8n
    NAME READY STATUS RESTARTS AGE
    n8n-77889b4756-9wqtq 1/1 Running 0 9m6s
    n8n-postgresql-0 1/1 Running 0 112m
    n8n-redis-master-0 1/1 Running 0 9m6s
    n8n-webhook-7ffccd5dd8-njpnm 1/1 Running 1 (8m48s ago) 9m6s
    n8n-worker-f7fff89fb-k45ff 1/1 Running 0 8m20s
    n8n-worker-f7fff89fb-nv994 1/1 Running 1 (8m42s ago) 9m6s

What is the error message (if any)?

Please share your workflow

Lost Redis connection. Trying to reconnect in 1s...

Recovered Redis connection
Execution XX (job YY) failed

Error: timeout exceeded when trying to connect

Simple Webhook


Error: timeout exceeded when trying to connect
    at pg-pool/index.js:45
    at PostgresDriver.obtainMasterConnection
    at PostgresQueryRunner.query
    at ExecutionRepository.findSingleExecution
    at JobProcessor.processJob

What changed

The only infrastructure change was migrating Redis from an in-cluster Redis instance to external Aiven Valkey.

Before the migration:

  • queue mode worked correctly
  • executions completed successfully
  • no PostgreSQL timeout errors

After the migration:

  • Redis reconnect messages started appearing

  • workers fail executions

  • PostgreSQL connection timeout errors appear

    Additional observations

    Connectivity from worker pods to Aiven Valkey appears healthy:

    23 packets transmitted
    
    23 received
    
    0% packet loss
    
    avg latency ~16ms
    

Using External redis

Using Redis in Cluster

Information on your n8n setup

  • **n8n version:**2.25.7
  • Database (default: postgresql**):**
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (kuber):
  • Operating system: Debian12
    i tried on latest v1 problem is the same

Hi @Antonio1

Aiven Valkey requires specific configurations that differ from a standard in-cluster Redis deployment.

  • TLS/SSL Requirement: Aiven services require TLS. Ensure your n8n environment variables include:
    • N8N_REDIS_TLS=true (or the equivalent setting depending on your n8n version/custom image).
    • If you are using a custom connection string, ensure it uses rediss:// (with two 's’s) instead of redis://.
  • TCP Keepalives: External connections are more prone to being dropped by cloud firewalls/load balancers. Ensure your Kubernetes nodes have appropriate TCP keepalive settings, or check if Aiven provides a recommended keepalive interval.
  • Network Policies: Verify that your Kubernetes Egress policies allow traffic on the Valkey port (usually 6379 or a custom Aiven port) to the external Aiven IP range.

Let me know if these help

thanks for reply

yes i know i tried

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT: 30000
QUEUE_BULL_REDIS_TIMEOUT: 30000
QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY: 15000

and YES im using TLS with aiven

tls:
    enabled: true
host: valkey-XXXXXXX.l.aivencloud.com
port: 21275

username: default
password: "PASS_HERE"

LOG FROM n8N

Execution 29 (job 99) failed

Error: timeout exceeded when trying to connect

    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/pg-pool@3.6.2_pg@8.12.0/node_modules/pg-pool/index.js:45:11

    at PostgresDriver.obtainMasterConnection (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresDriver.ts:1181:28)

    at PostgresQueryRunner.query (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresQueryRunner.ts:248:36)

    at SelectQueryBuilder.loadRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3660:25)

    at SelectQueryBuilder.getRawMany (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1617:29)

    at SelectQueryBuilder.executeEntitiesAndRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3322:26)

    at SelectQueryBuilder.getRawAndEntities (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1661:29)

    at SelectQueryBuilder.getOne (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1688:25)

    at ExecutionRepository.findSingleExecution (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+db@file+packages+@n8n+db_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1._ab22bba05a964211b9fe14bf4b841570/node_modules/@n8n/db/src/repositories/execution.repository.ts:315:21)

    at JobProcessor.processJob (/usr/local/lib/node_modules/n8n/src/scaling/job-processor.ts:57:21)

Problem with execution 29: Error: timeout exceeded when trying to connect. Aborting.

Error: timeout exceeded when trying to connect (execution 29)

Error: Error: timeout exceeded when trying to connect

    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/bull@4.16.4_patch_hash=a4b6d56db16fe5870646929938466d6a5c668435fd1551bed6a93fffb597ba42/node_modules/bull/lib/job.js:523:18)

    at processTicksAndRejections (node:internal/process/task_queues:104:5)

Execution 30 (job 100) failed

Error: timeout exceeded when trying to connect

    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/pg-pool@3.11.0_pg@8.17.0/node_modules/pg-pool/index.js:45:11

    at PostgresDriver.obtainMasterConnection (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-16_@sentry+node@10.36.0_mysql2@3.17.0_pg@8.17.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresDriver.ts:1182:28)

    at PostgresQueryRunner.query (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-16_@sentry+node@10.36.0_mysql2@3.17.0_pg@8.17.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresQueryRunner.ts:248:36)

    at SelectQueryBuilder.loadRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-16_@sentry+node@10.36.0_mysql2@3.17.0_pg@8.17.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3660:25)

    at SelectQueryBuilder.getRawMany (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-16_@sentry+node@10.36.0_mysql2@3.17.0_pg@8.17.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1617:29)

    at SelectQueryBuilder.executeEntitiesAndRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-16_@sentry+node@10.36.0_mysql2@3.17.0_pg@8.17.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3322:26)

    at SelectQueryBuilder.getRawAndEntities (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-16_@sentry+node@10.36.0_mysql2@3.17.0_pg@8.17.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1661:29)

    at SelectQueryBuilder.getOne (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-16_@sentry+node@10.36.0_mysql2@3.17.0_pg@8.17.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1688:25)

can it be?

Job gets stalled in Redis ↓
Main n8n sees execution with status "running" ↓
Tries to read it from PostgreSQL to show the status ↓
pg-pool timeout — because many such "hanging" requests pile up simultaneously

Yes, that shape is possible, but the trace you pasted is pg-pool, so the next gate is Postgres capacity under worker concurrency, not another Redis timeout knob. A few stalled jobs can keep execution reads open long enough that main/webhook/workers all hit the same DB ceiling.

One small check: how many workers are up, what is DB_POSTGRESDB_POOL_SIZE, and what is Postgres max_connections after reserved slots? If the pool math is already tight, Valkey just exposed the DB bottleneck.

@Antonio1

You need to provide more “breathing room” for the database connections so that status checks can succeed even if workers are misbehaving.

  • Set the following environment variable in your n8n deployment: DB_POSTGRESDB_POOL_SIZE: "50" (or higher, depending on your total worker count).
  • Crucial: Ensure your PostgreSQL max_connections (in postgresql.conf or your cloud provider settings) is set to at least (number_of_pods * DB_POSTGRESDB_POOL_SIZE) + 20.

To check for DB Max Connections, run this query on your PostgreSQL instance to see if you are hitting the limit:

SELECT count(*), state FROM pg_stat_activity GROUP BY state;
SHOW max_connections;

If count(*) is close to max_connections, you need to either increase the DB limit or decrease the DB_POSTGRESDB_POOL_SIZE across your workers.

Since you are using Aiven, the TLS handshake is likely the bottleneck during reconnection events.

  • Increase Redis Connection Timeout: You have set QUEUE_BULL_REDIS_CONNECTION_TIMEOUT to 30s. Try increasing this to 60000 (60s) to allow for slower TLS handshakes over the public internet.
  • Disable Redis Cluster Mode (if applicable): If you are not explicitly using a Valkey/Redis cluster, ensure n8n is configured for a single-node connection.
  • Check Aiven Metrics: Log into your Aiven console and check the “Connection Count” and “CPU Usage” for your Valkey service. If you see spikes during the time your n8n workers are failing, you might be hitting a connection limit on the Aiven side.

ok i just tested it again with. only one POST

and in the execution tab this POST appear as Queue then Failed
there is no other Workflows on this n8n i just trying to use Queen mode here
This work does not appear on any worker
it just fails on Main N8n pod

Lost Redis connection. Trying to reconnect in 1s... (0s/10s)

Recovered Redis connection

Enqueued execution 122 (job 166)

Execution 122 (job 166) failed

Error: timeout exceeded when trying to connect

    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/pg-pool@3.6.2_pg@8.12.0/node_modules/pg-pool/index.js:45:11

    at PostgresDriver.obtainMasterConnection (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresDriver.ts:1181:28)

    at PostgresQueryRunner.query (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresQueryRunner.ts:248:36)

    at SelectQueryBuilder.loadRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3660:25)

    at SelectQueryBuilder.getRawMany (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1617:29)

    at SelectQueryBuilder.executeEntitiesAndRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3322:26)

    at SelectQueryBuilder.getRawAndEntities (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1661:29)

    at SelectQueryBuilder.getOne (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1688:25)

    at ExecutionRepository.findSingleExecution (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+db@file+packages+@n8n+db_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1._ab22bba05a964211b9fe14bf4b841570/node_modules/@n8n/db/src/repositories/execution.repository.ts:315:21)

    at JobProcessor.processJob (/usr/local/lib/node_modules/n8n/src/scaling/job-processor.ts:57:21)

Problem with execution 122: Error: timeout exceeded when trying to connect. Aborting.

Error: timeout exceeded when trying to connect (execution 122)

Error: Error: timeout exceeded when trying to connect

    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/bull@4.16.4_patch_hash=a4b6d56db16fe5870646929938466d6a5c668435fd1551bed6a93fffb597ba42/node_modules/bull/lib/job.js:523:18)

    at processTicksAndRejections (node:internal/process/task_queues:104:5)

Lost Redis connection. Trying to reconnect in 1s... (0s/10s)

Recovered Redis connection

That changes the read. If one test execution never lands on any worker, this is not a Postgres pool-size problem yet. The job is being queued, then the worker side is not staying attached to the same Redis/Valkey queue long enough to claim it.

Post one worker startup log line where it connects in queue mode, plus EXECUTIONS_MODE, QUEUE_BULL_REDIS_HOST/PORT/TLS and QUEUE_BULL_PREFIX with secrets removed. First thing to confirm is that main and worker point at the exact same queue config, not just the same Valkey host.

@Antonio1 :white_check_mark: Managing state-pointer and memory issues in n8n workflows requires a clean, modular architecture, especially when syncing complex data across Google Docs and Sheets.

:white_check_mark: If you are looking to simplify this logic or need a robust, production-ready solution to stabilize your AI agents, let’s connect.

:white_check_mark: I specialize in building and optimizing high-performance n8n, AI, Make.com, and GHL automation systems

EXECUTIONS_MODE

{26-06-12 12:52}Antons-MacBook-Pro-2:~ anton% for pod in $(kubectl get pods -n n8n -o name); do
echo "=== $pod ==="
kubectl exec -n n8n ${pod#pod/} -- env | grep EXECUTIONS_MODE
done
=== pod/n8n-564fbc565f-lxnsc ===
Defaulted container "n8n-main" out of: n8n-main, npm-install (init)
EXECUTIONS_MODE=queue
=== pod/n8n-postgresql-0 ===
=== pod/n8n-webhook-6bfc9f5cd8-dcv7l ===
EXECUTIONS_MODE=queue
=== pod/n8n-worker-7fb4c7d87d-jzwth ===
Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)
EXECUTIONS_MODE=queue
=== pod/n8n-worker-7fb4c7d87d-k82xw ===
Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)
EXECUTIONS_MODE=queue
=== pod/n8n-worker-7fb4c7d87d-kkdm9 ===
Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)
EXECUTIONS_MODE=queue
=== pod/n8n-worker-7fb4c7d87d-lqt7j ===
Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)
EXECUTIONS_MODE=queue
=== pod/n8n-worker-7fb4c7d87d-mspxz ===
Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)
EXECUTIONS_MODE=queue
=== pod/n8n-worker-7fb4c7d87d-xqcr2 ===
Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)
EXECUTIONS_MODE=queue



and

{26-06-12 12:52}Antons-MacBook-Pro-2:~ anton% for pod in $(kubectl get pods -n n8n -o name); do

  echo "=== $pod ==="

  kubectl exec -n n8n ${pod#pod/} -- env | grep QUEUE_BULL_

done

=== pod/n8n-564fbc565f-lxnsc ===

Defaulted container "n8n-main" out of: n8n-main, npm-install (init)

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_USERNAME=default

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_REDIS_PORT=21275

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_REDIS_TLS=true

=== pod/n8n-postgresql-0 ===

=== pod/n8n-webhook-6bfc9f5cd8-dcv7l ===

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

QUEUE_BULL_REDIS_PORT=21275

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_REDIS_TLS=true

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

QUEUE_BULL_REDIS_USERNAME=default

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

=== pod/n8n-worker-7fb4c7d87d-jzwth ===

Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

QUEUE_BULL_REDIS_USERNAME=default

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

QUEUE_BULL_REDIS_TLS=true

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_REDIS_PORT=21275

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

=== pod/n8n-worker-7fb4c7d87d-k82xw ===

Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_REDIS_USERNAME=default

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

QUEUE_BULL_REDIS_TLS=true

QUEUE_BULL_REDIS_PORT=21275

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

=== pod/n8n-worker-7fb4c7d87d-kkdm9 ===

Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_REDIS_USERNAME=default

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

QUEUE_BULL_REDIS_PORT=21275

QUEUE_BULL_REDIS_TLS=true

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

=== pod/n8n-worker-7fb4c7d87d-lqt7j ===

Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_REDIS_USERNAME=default

QUEUE_BULL_REDIS_TLS=true

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_REDIS_PORT=21275

=== pod/n8n-worker-7fb4c7d87d-mspxz ===

Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_REDIS_USERNAME=default

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

QUEUE_BULL_REDIS_PORT=21275

QUEUE_BULL_REDIS_TLS=true

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

=== pod/n8n-worker-7fb4c7d87d-xqcr2 ===

Defaulted container "n8n-worker" out of: n8n-worker, npm-install (init)

QUEUE_BULL_REDIS_DUALSTACK=false

QUEUE_BULL_REDIS_KEEP_ALIVE_DELAY=15000

QUEUE_BULL_REDIS_TLS=true

QUEUE_BULL_REDIS_TIMEOUT=30000

QUEUE_BULL_REDIS_DB=0

QUEUE_BULL_SETTINGS_STALLED_INTERVAL=60000

QUEUE_BULL_REDIS_PASSWORD=PASSWORD_SECURE

QUEUE_BULL_SETTINGS_LOCK_DURATION=60000

QUEUE_BULL_SETTINGS_LOCK_RENEW_TIME=30000

QUEUE_BULL_REDIS_HOST=valkey-757370-XXXX.l.aivencloud.com

QUEUE_BULL_REDIS_PORT=21275

QUEUE_BULL_REDIS_CONNECTION_TIMEOUT=30000

QUEUE_BULL_REDIS_USERNAME=default

Those env dumps are useful: main, webhook and the workers all look pointed at the same Valkey queue now, so this no longer looks like a different Redis host/port/TLS config between pods.

The two missing lines are the worker side actually starting/claiming jobs and the DB pool ceiling. Post one worker log around startup/job 166 plus DB_POSTGRESDB_POOL_SIZE and Postgres max_connections; with six workers, a small Postgres pool/max_connections can still make the failure surface as pg-pool even when Redis config matches.

{26-06-12 15:07}Antons-MacBook-Pro-2:~ anton% kubectl get pods -n n8n
NAME READY STATUS RESTARTS AGE
n8n-6687b7fb7d-vj2xr 1/1 Running 0 42s
n8n-postgresql-0 1/1 Running 0 17h
n8n-worker-7c5c5d5dc-x2x9d 1/1 Running 0 42s

ok so i make it very simple
one main + one worker (postgresql in cluster )

=Worker=
nothing related to. 124 job

Concurrency is set to less than 5. THIS CAN LEAD TO AN UNSTABLE ENVIRONMENT. Please consider increasing it to at least 5 to make best use of the worker.

n8n Task Broker ready on 127.0.0.1, port 5679

Failed to start Python task runner in internal mode. because Python 3 is missing from this system. Launching a Python runner in internal mode is intended only for debugging and is not recommended for production. Users are encouraged to deploy in external mode. See: 


[license SDK] Skipping renewal on init: renewOnInit is disabled in config

[license SDK] Skipping renewal on init: autoRenewEnabled is disabled in config

[license SDK] Skipping renewal on init: license cert is not initialized

Instance registered

Discovered 4 cluster checks

n8n worker server listening on port 5678

n8n worker is now ready

 * Version: 2.25.7

 * Concurrency: 2

Registered runner "JS Task Runner" (oqClB5JFV1-IPGaVNCRFu)

Worker started execution 123 (job 167)

Worker finished execution 123 (job 167)

=Main=
124 Execution

Defaulted container "n8n-main" out of: n8n-main, npm-install (init)

Initializing n8n process

n8n ready on ::, port 5678

[license SDK] Skipping renewal on init: license cert is not initialized

Attempting to reinstall missing packages

Failed to execute npm command

Failed to reinstall community package n8n-nodes-minio: Failed to execute npm command

Failed to execute npm command

Failed to reinstall community package n8n-nodes-firebird: Failed to execute npm command

Instance registered

Discovered 4 cluster checks

Cluster check warning Detected 2 instances claiming leader role: 0490eef8-9207-4ef7-a379-4699f18e001c, 2586c901-fd3c-4c06-a190-a4197e69f325

Currently active workflows:

- My workflow (ID: QFQvCXo8mBhadrAM)

Version: 2.25.7

Building workflow dependency index...

Start Active Workflows:

Finished building workflow dependency index. Processed 0 draft workflows, 0 published workflows.

Activated workflow "My workflow" (ID: QFQvCXo8mBhadrAM)




Editor is now accessible via:

URL-HERE

Enqueued execution 123 (job 167)

Execution 123 (job 167) finished

Enqueued execution 124 (job 168)

User attempted to access a workflow without permissions

Execution 124 (job 168) failed

Error: timeout exceeded when trying to connect

    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/pg-pool@3.6.2_pg@8.12.0/node_modules/pg-pool/index.js:45:11

    at PostgresDriver.obtainMasterConnection (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresDriver.ts:1181:28)

    at PostgresQueryRunner.query (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/driver/postgres/PostgresQueryRunner.ts:248:36)

    at SelectQueryBuilder.loadRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3660:25)

    at SelectQueryBuilder.getRawMany (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1617:29)

    at SelectQueryBuilder.executeEntitiesAndRawResults (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:3322:26)

    at SelectQueryBuilder.getRawAndEntities (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1661:29)

    at SelectQueryBuilder.getOne (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-15_@sentry+node@9.42.1_mysql2@3.15.0_pg@8.12.0_sqlite3@5.1.7/node_modules/src/query-builder/SelectQueryBuilder.ts:1688:25)

    at ExecutionRepository.findSingleExecution (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+db@file+packages+@n8n+db_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1._ab22bba05a964211b9fe14bf4b841570/node_modules/@n8n/db/src/repositories/execution.repository.ts:315:21)

    at JobProcessor.processJob (/usr/local/lib/node_modules/n8n/src/scaling/job-processor.ts:57:21)




Problem with execution 124: Error: timeout exceeded when trying to connect. Aborting.

Error: timeout exceeded when trying to connect (execution 124)

Error: Error: timeout exceeded when trying to connect

    at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/bull@4.16.4_patch_hash=a4b6d56db16fe5870646929938466d6a5c668435fd1551bed6a93fffb597ba42/node_modules/bull/lib/job.js:523:18)

    at processTicksAndRejections (node:internal/process/task_queues:104:5)




User attempted to access a workflow without permissions

User attempted to access a workflow without permissions

Lost Redis connection. Trying to reconnect in 1s... (0s/10s)

Recovered Redis connection

Lost Redis connection. Trying to reconnect in 1s... (0s/10s)

Recovered Redis connection

125 OK
so it is a kind of randon

==Worker==

n8n worker is now ready

Version: 2.25.7

Concurrency: 2

Registered runner "JS Task Runner" (oqClB5JFV1-IPGaVNCRFu)
Worker started execution 123 (job 167)
Worker finished execution 123 (job 167)
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Worker started execution 125 (job 169)
Worker finished execution 125 (job 169)

=Main=

Problem with execution 124: Error: timeout exceeded when trying to connect. Aborting.
Error: timeout exceeded when trying to connect (execution 124)
Error: Error: timeout exceeded when trying to connect
at Queue.onFailed (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/bull@4.16.4_patch_hash=a4b6d56db16fe5870646929938466d6a5c668435fd1551bed6a93fffb597ba42/node_modules/bull/lib/job.js:523:18)
at processTicksAndRejections (node:internal/process/task_queues:104:5)

User attempted to access a workflow without permissions
User attempted to access a workflow without permissions
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
Recovered Redis connection
Enqueued execution 125 (job 169)
Execution 125 (job 169) finished
User attempted to access a workflow without permissions 

i done additinal test
i started new pod inside n8n workplace

redis-cli
-h ``valkey-XXXX.l.aivencloud.com``
-p 21275
--tls
--user default
-a 'YOUR_PASSWORD'
SUBSCRIBE test

and. use oter CLIENT from my PC to send events

while true; do
redis-cli
-h ``valkey-XXXX.l.aivencloud.com``
-p 21275
--tls
--user default
-a 'YOUR_PASSWORD'
PUBLISH test hello
sleep 1
done

=Result=
new pod is not losing connection with redis

  1. “hello”

  2. “message”

  3. “test”

  4. “hello”

  5. “message”

  6. “test”

  7. “hello”

  8. “message”

  9. “test”

    =While Worker n8n=

    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)
    
    Recovered Redis connection
    
    Lost Redis connection. Trying to reconnect in 1s... (0s/10s)