Skip to content

When updating multiple policies in the UI, the policies are now updated in series to reduce server/DB load.#32212

Merged
getvictor merged 1 commit intomainfrom
victor/31173-deadlock-frontend
Aug 25, 2025
Merged

When updating multiple policies in the UI, the policies are now updated in series to reduce server/DB load.#32212
getvictor merged 1 commit intomainfrom
victor/31173-deadlock-frontend

Conversation

@getvictor
Copy link
Copy Markdown
Member

@getvictor getvictor commented Aug 22, 2025

Fixes #31173

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.

Testing

  • QA'd all new/changed functionality manually

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 22, 2025

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.01%. Comparing base (1abb5c0) to head (e342357).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
...policies/ManagePoliciesPage/ManagePoliciesPage.tsx 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #32212      +/-   ##
==========================================
- Coverage   64.02%   64.01%   -0.01%     
==========================================
  Files        1988     1988              
  Lines      194213   194217       +4     
  Branches     6547     6547              
==========================================
  Hits       124337   124337              
- Misses      60184    60188       +4     
  Partials     9692     9692              
Flag Coverage Δ
frontend 52.16% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@getvictor getvictor marked this pull request as ready for review August 22, 2025 15:54
@getvictor getvictor requested a review from a team as a code owner August 22, 2025 15:54
getvictor added a commit that referenced this pull request Aug 22, 2025
Fixes #31173 

Reproduced and fixed in loadtest environment. Uncovered another source
of deadlocks, filed as a separate:
#32201
- Also, still seeing some deadlocks (a lot fewer) in DB, and they are
hidden from the API results by retries. They may still be happening
because locks happen row by row and not all at once. A potential fix
would be to lock the whole policy_membership table.

Additional frontend fix, which is needed to prevent potential timeouts:
#32212

Backend + frontend fix should be a sufficient fix for this issue
(ignoring the issue with the long software transaction).

Also, this PR contains some refactoring to split out the 1-host use
case.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.

## Testing

- [x] QA'd all new/changed functionality manually


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* Bug Fixes
* Resolved rare deadlocks during concurrent policy updates and bulk
automations.
* Correctly clears stale MDM data and actions on host re-enrollment and
platform changes.
* Performance Improvements
* Optimized policy issue recalculation with per-host updates to reduce
contention.
* Improved concurrency handling for bulk policy updates to avoid lock
contention.
* Reliability
* More robust host enrollment: updates seen time, display name, and
label membership consistently.
* Ensures accurate policy-issue counts after membership changes and
re-enrollment.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy link
Copy Markdown
Contributor

@sgress454 sgress454 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested 👍

@getvictor getvictor merged commit 2fd6a86 into main Aug 25, 2025
15 of 16 checks passed
@getvictor getvictor deleted the victor/31173-deadlock-frontend branch August 25, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating automations for 10+ policy automations at one time results in deadlock in large environments

2 participants