[GH-ISSUE #554] duplicate tasks show after deleting and recreating them in different automation policy #352

Closed
opened 2026-03-02 02:15:42 +03:00 by kerem · 6 comments
Owner

Originally created by @bbrendon on GitHub (Jun 4, 2021).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/554

Originally assigned to: @sadnub on GitHub.

Tasks created by policy:
image

In my setup I have a global default policy and a client level policy. I removed the tasks from the policy on the client and created the task on the global policy. After that, some of the tasks are like you see in the screenshot. Some agents do not have duplicate tasks. Its very sporadic. I tried "Sync Policies" and also "Remove orphaned tasks". Neither made a difference.

Also, as I'm investigating this, I was looking in "Policy Overview" and the tasks assigned to workstation and servers do not match the global policy plus the client policy. Maybe I'm misunderstanding how that works but based on the behavior of the software, that was my expectation.

I'm running 0.6.13 on debian.
agents are 1.5.7. I haven't noticed any other versions.

Originally created by @bbrendon on GitHub (Jun 4, 2021). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/554 Originally assigned to: @sadnub on GitHub. Tasks created by policy: ![image](https://user-images.githubusercontent.com/6364477/120836780-cc291c80-c51a-11eb-8ecf-e2b6a980fb44.png) In my setup I have a global default policy and a client level policy. I removed the tasks from the policy on the client and created the task on the global policy. After that, some of the tasks are like you see in the screenshot. Some agents do not have duplicate tasks. Its very sporadic. I tried "Sync Policies" and also "Remove orphaned tasks". Neither made a difference. Also, as I'm investigating this, I was looking in "Policy Overview" and the tasks assigned to workstation and servers do not match the global policy plus the client policy. Maybe I'm misunderstanding how that works but based on the behavior of the software, that was my expectation. I'm running 0.6.13 on debian. agents are 1.5.7. I haven't noticed any other versions.
kerem 2026-03-02 02:15:42 +03:00
  • closed this issue
  • added the
    bug
    fixed
    labels
Author
Owner

@bbrendon commented on GitHub (Jun 4, 2021):

Also, I have 5 of these celery errors in the logs in the last day or so. Not sure what they are about.

[2021-06-02 22:54:16,788: ERROR/ForkPoolWorker-5] Task automation.tasks.delete_policy_autotasks_task[476f9d3e-c49e-4003-ab91-8c980b02ebff] raised unexpected: DatabaseError('Save with update_fields did not affect any rows.')
Traceback (most recent call last):
  File "/rmm/api/env/lib/python3.9/site-packages/celery/app/trace.py", line 450, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/rmm/api/env/lib/python3.9/site-packages/celery/app/trace.py", line 731, in __protected_call__
    return self.run(*args, **kwargs)
  File "/rmm/api/tacticalrmm/automation/tasks.py", line 108, in delete_policy_autotasks_task
    t.delete_task_on_agent()
  File "/rmm/api/tacticalrmm/autotasks/models.py", line 367, in delete_task_on_agent
    self.save(update_fields=["sync_status"])
  File "/rmm/api/tacticalrmm/logs/models.py", line 315, in save
    return super(BaseAuditModel, self).save(*args, **kwargs)
  File "/rmm/api/env/lib/python3.9/site-packages/django/db/models/base.py", line 726, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/rmm/api/env/lib/python3.9/site-packages/django/db/models/base.py", line 763, in save_base
    updated = self._save_table(
  File "/rmm/api/env/lib/python3.9/site-packages/django/db/models/base.py", line 850, in _save_table
    raise DatabaseError("Save with update_fields did not affect any rows.")
django.db.utils.DatabaseError: Save with update_fields did not affect any rows.


<!-- gh-comment-id:854953232 --> @bbrendon commented on GitHub (Jun 4, 2021): Also, I have 5 of these celery errors in the logs in the last day or so. Not sure what they are about. ``` [2021-06-02 22:54:16,788: ERROR/ForkPoolWorker-5] Task automation.tasks.delete_policy_autotasks_task[476f9d3e-c49e-4003-ab91-8c980b02ebff] raised unexpected: DatabaseError('Save with update_fields did not affect any rows.') Traceback (most recent call last): File "/rmm/api/env/lib/python3.9/site-packages/celery/app/trace.py", line 450, in trace_task R = retval = fun(*args, **kwargs) File "/rmm/api/env/lib/python3.9/site-packages/celery/app/trace.py", line 731, in __protected_call__ return self.run(*args, **kwargs) File "/rmm/api/tacticalrmm/automation/tasks.py", line 108, in delete_policy_autotasks_task t.delete_task_on_agent() File "/rmm/api/tacticalrmm/autotasks/models.py", line 367, in delete_task_on_agent self.save(update_fields=["sync_status"]) File "/rmm/api/tacticalrmm/logs/models.py", line 315, in save return super(BaseAuditModel, self).save(*args, **kwargs) File "/rmm/api/env/lib/python3.9/site-packages/django/db/models/base.py", line 726, in save self.save_base(using=using, force_insert=force_insert, File "/rmm/api/env/lib/python3.9/site-packages/django/db/models/base.py", line 763, in save_base updated = self._save_table( File "/rmm/api/env/lib/python3.9/site-packages/django/db/models/base.py", line 850, in _save_table raise DatabaseError("Save with update_fields did not affect any rows.") django.db.utils.DatabaseError: Save with update_fields did not affect any rows. ```
Author
Owner

@silversword411 commented on GitHub (Jun 4, 2021):

Are these policies from before 0.6.9? There was a bug with automation policies and weird stuff happening. Only deleting the entire policy and re-creating fixed them....thought you had said in Discord you already did that but.....

<!-- gh-comment-id:854994312 --> @silversword411 commented on GitHub (Jun 4, 2021): Are these policies from before 0.6.9? There was a bug with automation policies and weird stuff happening. Only deleting the entire policy and re-creating fixed them....thought you had said in Discord you already did that but.....
Author
Owner

@bbrendon commented on GitHub (Jun 4, 2021):

OOo. The policies for the sites were created before 0.6.9. the global policy i'm not sure.

<!-- gh-comment-id:855075540 --> @bbrendon commented on GitHub (Jun 4, 2021): OOo. The policies for the sites were created before 0.6.9. the global policy i'm not sure.
Author
Owner

@sadnub commented on GitHub (Jun 7, 2021):

Thanks for your help on this! I was able to track down the issue to only tasks that run on check failure and only when agents were offline (or hadn't removed the old task since it was last removed)

I just pushed a fix. It will be in the next release.

<!-- gh-comment-id:855541896 --> @sadnub commented on GitHub (Jun 7, 2021): Thanks for your help on this! I was able to track down the issue to only tasks that run on check failure and only when agents were offline (or hadn't removed the old task since it was last removed) I just pushed a fix. It will be in the next release.
Author
Owner

@wh1te909 commented on GitHub (Jun 11, 2021):

released in 0.6.14

<!-- gh-comment-id:859261243 --> @wh1te909 commented on GitHub (Jun 11, 2021): released in 0.6.14
Author
Owner

@bbrendon commented on GitHub (Jun 12, 2021):

I hate to be the bearer of bad news but this doesn't seem to be resolved. At first it did but now I'm finding more and more again with duplicate TASKS. I haven't tested or enabled any checks.

What I did was...

  1. disable all automation policies.
  2. wait about 20 minutes.
  3. enable the global policy
  4. duplicates tasks appeared after about an hour. So far I have found at least 5 agents.
<!-- gh-comment-id:859980510 --> @bbrendon commented on GitHub (Jun 12, 2021): I hate to be the bearer of bad news but this doesn't seem to be resolved. At first it did but now I'm finding more and more again with duplicate TASKS. I haven't tested or enabled any checks. What I did was... 1. disable all automation policies. 2. wait about 20 minutes. 3. enable the global policy 4. duplicates tasks appeared after about an hour. So far I have found at least 5 agents.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#352
No description provided.