Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Trigger incorrectly fires when enabled by action #2626

Closed
2 tasks done
otelom opened this issue Oct 29, 2023 · 1 comment
Closed
2 tasks done

[BUG] Trigger incorrectly fires when enabled by action #2626

otelom opened this issue Oct 29, 2023 · 1 comment
Labels
area/backend Something in the core of companion BUG Something isn't working
Milestone

Comments

@otelom
Copy link

otelom commented Oct 29, 2023

Is this a bug in companion itself or a module?

  • I believe this to be a bug in companion

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a button with the action to toggle a trigger state and sometimes, when I press the button to enable it, it also executes the actions on the trigger and that should not happen.

I would show you the logs but apparently by restarting companion it deletes the logs, and in an attempt to reproduce this, I restarted companion and lost them...

The logs were something like:
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Pressed
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Released
Controls/ControlTypes/Triggers: Execute [name of my trigger]

Then I tried again and again and logs were just:
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Pressed
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Released
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Pressed
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Released
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Pressed
Surface/Handler/streamdeck:A00xxxxx: Button 1.4 Released

Since I don't have the logs anymore I cannot confirm for sure that "Controls/ControlTypes/Triggers" was what it said but was somethiing like it followed by "Execute" and the name of the trigger.
Also, "A00xxxxx" is my streamdeck serial number but redacted for safety.

Steps To Reproduce

Cannot tell you exactly how to reproduce as it happens randomly but I can show you all my configurations.

Trigger Settings:

Events and Conditions:
image

Actions:
trigger actions

Button to toggle trigger status:
button settings to toggle

Expected Behavior

The trigger should only be enabled and not executed.
Trigger should only execute when the events (and possible conditions) were met.

Environment (please complete the following information)

- OS:
- Browser: Chrome: 118.0.5993.118
- Companion Version: Build 3.1.1+6229-stable-4593dd7f

Additional context

I would export the support bundle but I don't know where to upload it to or who to give it to!
You mention "It is not recommended to post this publicly, rather you should send it privately to the necessary party."
Let me know if you need it or who should I send it to should it be necessary.

Maybe related or can help to get some idea of what's wrong is #2566.

@otelom otelom added the BUG Something isn't working label Oct 29, 2023
Julusian added a commit that referenced this issue Oct 30, 2023
always update the next execution time, even when not being executed so that when toggling enabled they don't think they are late
Julusian added a commit that referenced this issue Oct 30, 2023
always update the next execution time, even when not being executed so that when toggling enabled they don't think they are late
@Julusian
Copy link
Member

The screenshots were enough to be able to reproduce this.

As a reminder to my future self or anyone wondering what the problem was:

  1. Create a trigger with a 'time of day' event set 1 minute in the future
  2. Briefly enable then disable the trigger
  3. Wait until the time specified has past (another couple of minutes is good for clarity)
  4. enable the trigger, and it will execute

This was a bug in how we were tracking when the next execution time of the trigger was. Because it was disabled, we didnt perform the proper flow for keeping the 'nextExecutionTime' updated, so after the time had passed it was still pointing to when the skipped execution should have been done. This meant that once it was enabled, it saw that it should have executed and did so, assuming it was late (caused by clock drift, or high cpu usage or something).

The fix is easy, always update the 'nextExecutionTime' updated, even when the trigger is disabled

This is fixed in beta, and will be in 3.1.2 due to be released this week.

@Julusian Julusian added the area/backend Something in the core of companion label Oct 30, 2023
@Julusian Julusian added this to the v3.1 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend Something in the core of companion BUG Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants