Why do some workflows run even when they are inactive?

Describe the issue/error/question

After turning off the workflows, they are still being executed.
I had originally suspected it is an issue of kafkajs but it doesnt seem so as they can be seen in the execution history.

The workflow

It consists of just one kafka trigger and a kafka node which sends out messages during off hour

Information on your n8n setup

  • n8n version: 173
  • Database you’re using: postgres
  • Running n8n via: npm

Hey @cccc,

That is a bit odd, Are you using queue mode or is it just one instance of n8n? When you try to deactive the workflow does anything appear in the n8n log file?

I believe just one instance. I’ve never set any config for queue mode.
And the PATCH request to set active to false has always returned 200
Where should can the log file be checked?

The log is normally to console so I am not sure where NPM writes it console output, What you can do is enable file logging with the options on this page: Logging - n8n Documentation Would be interesting to pop it on then disable the worklfow and when it triggers again grab the workflow and we can take a look.

Hey @cccc,

Out of interest when you disabled the workflow did you do it from the UI or the CLI?

@jon I havent been able to find anything useful from the debug logs, everything seems normal.
I have always disabled the workflow from the UI, suspecting if it has something to do with database connection.

In some cases if I turn off Workflow 1 and Workflow 3 which have the same kafka topic as Workflow 2, I receive 3 responses from all of them.

Running into this issue again when two instance shares the same DB with different encryptionkey. Could this be that cause ?

Not only did an inactive flow run, there were cases where a deleted flow remains running until a restart.

Hey @cccc,

When you say sharing the same database do you mean the same database and schema or just the same database server? I would only have multiple instances on the same database if you are using queue mode.

@jon I mean as in I had a running n8n on the cloud but also on my own machine which link to the same database when doing dev work.

Jun 15 06:54:52 workflow-dev docker[901732]: 2022-06-15T06:54:52.845Z | verbose  | Successfully deactivated workflow "13" {"workflowId":"13","file":"ActiveWorkflowRunner.js","function":"remove"}
Jun 15 06:55:05 workflow-dev docker[901732]: 2022-06-15T06:55:05.716Z | debug    | Received trigger for workflow "Jennifer's (Authorised)" {"file":"ActiveWorkflowRunner.js","function":"returnFunctions.emi>
Jun 15 06:55:07 workflow-dev docker[901732]: 2022-06-15T06:55:07.370Z | debug    | Received child process message of type start for execution ID 3051. {"executionId":"3051","file":"WorkflowRunner.js"}
Jun 15 06:55:07 workflow-dev docker[901732]: 2022-06-15T06:55:07.382Z | verbose  | Initializing n8n sub-process {"pid":1306,"workflowId":13,"file":"WorkflowRunnerProcess.js","function":"runWorkflow"}
Jun 15 06:55:07 workflow-dev docker[901732]: 2022-06-15T06:55:07.683Z | verbose  | Workflow execution started {"workflowId":13,"file":"WorkflowExecute.js","function":"processRunExecutionData"}
Jun 15 06:55:07 workflow-dev docker[901732]: 2022-06-15T06:55:07.687Z | debug    | Received child process message of type processHook for execution ID 3051. {"executionId":"3051","file":"WorkflowRunner.js>
Jun 15 06:55:07 workflow-dev docker[901732]: 2022-06-15T06:55:07.688Z | debug    | Executing hook (hookFunctionsPush) {"executionId":"3051","workflowId":13,"file":"WorkflowExecuteAdditionalData.js","funct>
Jun 15 06:55:07 workflow-dev docker[901732]: 2022-06-15T06:55:07.688Z | debug    | Start processing node "Web Widget Trigger" {"node":"Web Widget Trigger","workflowId":13,"file":"WorkflowExecute.js"}
Jun 15 06:55:07 workflow-dev docker[901732]: 2022-06-15T06:55:07.689Z | debug    | Received child process message of type processHook for execution ID 3051. {"executionId":"3051","file":"WorkflowRunner.js>

This is my logs after deactivating a workflow, it still runs anyway

So are both instances using the same database instance for storing workflows and n8n settings or is it just a database you are reading from in your workflows?

The two have exactly the same database config. The same code base.
but this is when only one of them was running (which it shouldnt)

Did you restart both your instances after disabling your workflow? n8n would only read the active/inactive state when starting (or making changes in-app). So deactivating a workflow directly in the database (or through another instance writing to that database) won’t take effect if you have multiple instances in use.

To avoid such inconsistencies you’d need to provide each instance with its own database.

1 Like

I have been running it with sqlite on my own device but this still happens.

So is this now just one instance of n8n connecting to that one database and the issue still persists? Are you still running 173 as well?

Yes that’s correct.
I’m running it on 0.173.1

Can you try on the latest release and see if you have the same issue?