n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
48.48k stars 7.59k forks source link

Nodes with scheduled activations triggers 3 to 4 seperate executions #6567

Open igor-andonov opened 1 year ago

igor-andonov commented 1 year ago

Describe the bug NODEs: Gmail Trigger & Schedule Trigger Single trigger activates four executions when only one execution should occur.

Workflow A, using Gmail Trigger Workflow is currently set to execute "Every X" with X being 30 minutes. Workflow correctly executes every half hour (on the hour and its half), but activates four executions. Duration of each execution took no more than 1 second, with the "Started At" times for these executions being:

This case (activating 4 executions) has happened on all other triggers since the first four executions which did work as expected (only executing once). No changes to the workflow were made between its first and last execution.

Current settings are: Mode: "Every X" | Value: "30" | Unit: "Minutes"

Workflow B, using the 'Schedule Trigger' Similar bug in that each trigger executes four separate executions. Node is currently set to activate at 1900 every day, which it does. The only difference is the "Start At" times for the executions appear to be the same, with differing durations:

Current settings are: Trigger Interval: "Days" | Days Between Triggers: "1" | Trigger at Hour: "7pm" | Trigger at Minute: "0"

To Reproduce Steps to reproduce the behaviour:

  1. Use either Gmail or Schedule Trigger
  2. Use the described settings listed under the respective workflows above (A & B) May not occur immediately. Workflows above started showing multiple executions 24 to 72 hours after the workflow was activated.

Expected behaviour The function of the node implies it triggers only one execution.

Environment (please complete the following information):

Additional context This issue seems similar but not entirely the same(?) as #5510

Joffcom commented 1 year ago

@igor-andonov this will be unrelated to 5510 from what I can see as the other issue is related to the same email being pulled rather than multiple executions at the same time.

I have just set up a couple of workflows the first is the Schedule Node set with the same options as you that will post to Slack on execution.

image

and the second is the same thing but using GMail as the trigger.

image

I guess for now the only thing to do is wait a couple of days and see if it can be reproduced.

Joffcom commented 1 year ago

Quick update, I have not yet seen the multiple activations occur in my logs or in the messages sent.

igor-andonov commented 1 year ago

Thanks for the update @Joffcom. I have tried replicating the issue too, but it doesn't appear to be coming up. The workflows with the issue were created in about version 0.218.~ and if I duplicate/export & import, the issue maintains - could this be a migration issue?

Regardless, it seems I can fix my issue just by creating an entirely new workflow and rebuilding the nodes.

Joffcom commented 1 year ago

Hey @igor-andonov,

It wouldn't be a migration issue, workflows are just json data but it could be that they are using an older node version.

I still have the workflows running and have not seen this yet but I have reproduced the issue with multiple gmail triggers which seems to happen on certain email types so if nothing else we have that.

Joffcom commented 1 year ago

Hey @igor-andonov,

It has been about 2 weeks now but oddly still not able to reproduce this, Has it happened for you again since?

karkill commented 1 year ago

Hey @Joffcom , I have 2 pod n8n and 1 pod n8n-worker. I create a schedule, active and then inactive it. This schedule still trigger when I inactive it. If I restart n8n deployment, it will stop trigger. I think it is the reason why it trigger multiple time. Please contact me if you need more information or have any updates.

Environment:

OS: Linux Infrastructure: k8s Version: 1.1.1 Database: PostgreSQL Execution mode : queue Trigger Trigger-config

Joffcom commented 1 year ago

Hey @karkill,

When you say 2 pod n8n what do you mean? My understanding is that if you stop a scheduled workflow it won't run again. The donwside is from your screenshot I don't know when it was stopped, Looking at it though you have it set to every minute but those execution times are not every minute so I suspect there could be more to this.

Quick edit.... That is the same issue that was originally reported though which has not appeared again since.

karkill commented 1 year ago

Hey @Joffcom 2 container run n8n and 1 run worker. When I inactive this schedule, it only send request to 1 container n8n. I think it is problems here. I try to run only 1 containter n8n, It is ok. The execution time is view not correct because I active and inactive many times at 13, 14 and 30 seconds. Thanks for the help!!! container

Joffcom commented 1 year ago

Hey @karkill,

Are the 2 n8n instances seperate? We don't support running 2 main instances at once so if you have 2 main instances pointing to the same databases I would expect there to be some issues.

If you are running 2 instances at once can you disable one and see if you get the same issue?

karkill commented 1 year ago

Thanks @Joffcom . As I mentioned above, if I run 1 instance n8n, it is OK but I think we need to support run more than 1 instance for High Availability . Can I run multiple worker?

Joffcom commented 1 year ago

Hey @karkill,

You can run multiple worker instances but you can only have the one main editor instance. We may change this in the future as part of a bigger project to look into how we handle scaling at the moment.