Hello n8n community,
I’ve encountered a potential issue where some executions are being executed more than once with the error of “No Active Execution Found”. I’d like to share my findings and some logs to see if anyone else has experienced similar behavior or has suggestions.
I added some logs to active-executions file as well.
Here are some logs - Regarding execution id: 6692658 - All of the logs happened in a few seconds.
debug | Resuming execution 6692658 {"scope":"executions","executionId":"6692658","file":"wait-tracker.js","function":"startExecution"}
debug | Found 3 executions. Setting timer for IDs: x, 6692658, y {"scope":"executions","file":"wait-tracker.js"...
debug | Resuming execution 6692658 {"scope":"executions","executionId":"6692658","file":"wait-tracker.js","function":"startExecution"}
debug | Execution added {"executionId":"6692658","file":"active-executions.js","function":"add"}
debug | Execution for workflow [name] id 6692658
debug | Execution added {"executionId":"6692658","file":"active-executions.js","function":"add"}
debug | Execution ID 6692658 had Execution data. Running with payload. {"executionId":"6692658","file":"workflow-runner.js","function":"runMainProcess",
debug | ActiveExecutions attachWorkflowExecution() called | Execution id 6692658
debug | ActiveExections getExecution() called | Execution ID: 6692658, Execution: [object Object]
debug | ActiveExections getExecution() called | Execution ID: 6692658
debug | Execution for workflow [name] was assigned id 6692658
debug | Execution ID 6692658 had Execution data. Running with payload.
debug | ActiveExecutions attachWorkflowExecution() called | Execution id 6692658
debug | ActiveExections getExecution() called | Execution ID: 6692658, Execution: [object Object]
debug | ActiveExections getExecution() called | Execution ID: 6692658, Execution: [object Object]
debug | Setting execution status for 6692658 to "waiting" {"file":"workflow-execute-additional-data.js","function":"setExecutionStatus"}
debug | ActiveExecutions setStatus() called | Execution id 6692658
debug | ActiveExections getExecution() called | Execution ID: 6692658, Execution: [object Object]
debug | Save execution data to database for execution ID 6692658
debug | ActiveExecutions getStatus() called | Execution id 6692658
debug | ActiveExections getExecution() called | Execution ID: 6692658, Execution: [object Object]
debug| ActiveExections getExecution() called | Execution ID: 6692658, Execution: [object Object]
debug | Execution finalized {"executionId":"6692658","file":"active-executions.js","function":"finalizeExecution"}
debug | Execution removed {"executionId":"6692658","file":"active-executions.js"}
As you can see we have two “Resuming execution 6692658” logs.
That’s why some of the execution functions get called more than once. Eventually one of the executions got finalized and removed from the ActiveExecutions list. But here is fun part:
debug | Setting execution status for 6692658 to "waiting" {"file":"workflow-execute-additional-data.js","function":"setExecutionStatus"}
debug | ActiveExecutions setStatus() called | Execution id 6692658
debug | ActiveExections getExecution() called | Execution ID: 6692658, Execution: undefined
debug | Start external error workflow {"executionId":"6692658",
Since the first execution is removed from the activeExections list, when n8n tries to call getExecution for the second execution, it throws error
debug | ActiveExections getExecution() called | Execution ID: 6692658, Execution: undefined
The execution is undefined. (rather than [object object])
What I realized is that there might be a race condition between getWaitingExecutions
, startExecution
and workflowrRunner.run
methods.
n8n doesn’t check if the execution is running now in waitTracker startExecution
function nor in the workflowRunner.run
and runMainProcess
functions. I think there should be a checking in those functions too to guarantee that an execution is being run only once.
It happens to a few of my workflows, which are quite big and contains lots of wait nodes.
Thanks for reading my long topic.
My setup
- n8n version: 1.63.4
- Database (default: SQLite): Postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main): default
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker