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

AAP-36604 (analytics) Thousands of zombie/orphaned Slow/Stuck DB queries in controller querying active host count #15715

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

arrestle
Copy link
Contributor

@arrestle arrestle commented Dec 18, 2024

SUMMARY

Related #[AAP-36604]
(analytics) Thousands of zombie/orphaned Slow/Stuck DB queries in controller querying active host count

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API
AWX VERSION
awx: 24.6.2.dev198+ge2be654df3
ADDITIONAL INFORMATION

Identified that HostMetricSummaryMonthlyTask was running once per node, but only needed to be run once, so wrapped the execution with an advisory_lock similar to how it's done in system.py

From comment by Elijah DeLee on AAP-36604

...this one (Jira ticket) for running the analytics/hostmetrics stuff on every single node.


Note we see this exception on postgres:

2024-11-26 12:50:18.892 UTC [2431843] ERROR:  duplicate key value violates unique constraint "main_hostmetricsummarymonthly_date_key"
2024-11-26 12:50:18.892 UTC [2431843] DETAIL:  Key (date)=(2021-12-01) already exists.
2024-11-26 12:50:18.892 UTC [2431843] STATEMENT:  INSERT INTO "main_hostmetricsummarymonthly" ("date", "license_consumed", "license_capacity", "hosts_added", "hosts_deleted", "indirectly_managed_hosts") VALUES ('2021-12-01'::date, 0, 0, 0, 0, 0), ('2022-01-01'::date, 0, 0, 0, 0, 0), ('2022-02-01'::date, 0, 0, 0, 0, 0), ('2022-03-01'::date, 0, 0, 0, 0, 0), ('2022-04-01'::date, 0, 0, 0, 0, 0), ('2022-05-01'::date, 0, 0, 0, 0, 0), ('2022-06-01'::date, 0, 0, 0, 0, 0), ('2022-07-...
 
further underlining issue that we are running same task on multiple controller nodes when we really should acquire some kind of advisory lock and only run it on one for each schedule.

@AlanCoding
Copy link
Member

Conflict warning with #15676, but it's not an actual problem, that just changes the import pattern and the code that uses the method won't change.

@arrestle arrestle enabled auto-merge (squash) December 18, 2024 22:04
@arrestle arrestle merged commit 1b418f7 into devel Dec 18, 2024
19 checks passed
@arrestle arrestle deleted the AAP-36604-zombie-processes branch December 18, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants