Describe the problem/error/question
We are observing an issue where workflows remain in the “In Progress” state for a long time and sometimes move into the “Queued” state. This increases throughput significantly and causes CPU usage spikes.
We would like to know if there is any way to automatically stop or terminate workflows after a specific time interval if they remain in progress or queued for too long.
Could you please suggest the best approach or configuration for handling this scenario?
What is the error message (if any)?
Information on your n8n setup
- n8n version: 2.20.9
- Database (default: SQLite): Postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main): Yes
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Macos
good morning @Kishan_Ghetiya
I would configure EXECUTIONS_TIMEOUT to prevent workflows from getting stuck indefinitely and review queue workers/concurrency, because executions accumulating in “Queued” usually indicates a capacity bottleneck in queue mode, not just a lack of timeout.
Hey @tamy.santos already set 2 environment variables but still Inprogress and Queued state
- EXECUTIONS_TIMEOUT=1800
- EXECUTIONS_TIMEOUT_MAX=3600
@Kishan_Ghetiya
These variables only terminate executions after they start running.
I would check if the workers are active and connected to the same Redis/Postgres and, as a workaround, restart workers/Redis carefully after pausing the triggers to drain the queue without generating new executions.
Welcome @Kishan_Ghetiya to our community! I’m Jay and I am a n8n verified creator.
The workflows queued for 33-50+ hours means your workers aren’t picking them up - not a timeout issue. EXECUTIONS_TIMEOUT only kicks in once a workflow is actually running; it doesn’t affect the queue backlog. To unblock: first confirm QUEUE_WORKER_CONCURRENCY is set high enough on each worker (default is 10, but if you have more active executions than that, jobs sit in queue). Second, manually clear the backlog in Postgres if needed: UPDATE execution_entity SET status = ‘error’ WHERE status IN (‘running’, ‘waiting’) AND “startedAt” < NOW() - INTERVAL ‘2 hours’. Then restart your workers and watch if new executions start processing immediately.