Skip to content

Fix Windows telemetry consent lock contention - #1107

Open
Gudge (MGudgin) wants to merge 1 commit into
mainfrom
user/gudge/fix-flaky-telemetry-test
Open

Fix Windows telemetry consent lock contention#1107
Gudge (MGudgin) wants to merge 1 commit into
mainfrom
user/gudge/fix-flaky-telemetry-test

Conversation

@MGudgin

@MGudginGudge (MGudgin) commented Sep 4, 2026

Copy link
Copy Markdown
Member

Fix intermittent Windows telemetry consent-store lock acquisition failures by using a persistent lock file whose exclusive open handle represents ownership. This avoids stale-looking lock paths when antivirus or indexer handles delay delete-on-close cleanup.

The externally visible consent behavior remains unchanged. Concurrent writers still serialize and use the existing bounded retry behavior.

Fixes#1105

Tests

  • cargo fmt --all -- --check
  • cargo test -p wxc_common 'telemetry::consent::tests::windows_tests::' — 50 passed
  • cargo clippy -p wxc_common --all-targets -- -D warnings
Microsoft Reviewers: Open in CodeFlow

This PR fixes intermittent telemetry consent-store lock acquisition failures on Windows.
Details
* Use a persistent lock file whose exclusive open handle represents ownership.
* Allow pre-existing unlocked lock files to be reused without waiting for deletion.
* Strengthen regression coverage with repeated concurrent consent writers.
Tests
* cargo fmt --all -- --check
* cargo test -p wxc_common 'telemetry::consent::tests::windows_tests::' (50 passed)
* cargo clippy -p wxc_common --all-targets -- -D warnings
Fixes#1105
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b627f594-042c-4e5e-ad47-12dffa50bd92
@MGudgin
Gudge (MGudgin) requested a review from a team as a code ownerSeptember 4, 2026 19:26
CopilotAI balanced review requested due to automatic review settings September 4, 2026 19:26
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused change correctly preserves bounded serialization while eliminating stale-path contention.

Review tier: Balanced
Findings: None

What changed in this PR

Replaces delete-on-close telemetry locking with a persistent Windows lock file controlled by exclusive handle ownership.

Changes:

  • Uses share_mode(0) for exclusive lock acquisition.
  • Adds persistent/pre-existing lock-file tests.
  • Strengthens concurrent consent-write stress coverage.
FileDescription
src/​core/​wxc_common/​src/​telemetry/​consent.rsUpdates Windows locking and regression tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for freeto 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.

Flaky telemetry consent concurrency test fails to acquire lock on Windows

3 participants

@MGudgin@RamonArjona4