Skip to content

Clean up stale dashboard run locks - #20140

Merged
James Newton-King (JamesNK) merged 4 commits into
microsoft:mainfrom
JamesNK:dashboard-clean-stale-run-locks
Sep 16, 2026
Merged

James Newton-King (JamesNK) merged 4 commits into
microsoft:mainfrom
JamesNK:dashboard-clean-stale-run-locks

Conversation

@JamesNK

@JamesNK James Newton-King (JamesNK) commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Description

Dashboard lock files normally disappear through DeleteOnClose, but an interrupted process or filesystem operation can leave an unheld sibling lock file behind. Because persistent run pruning and temporary-directory housekeeping only enumerated directories, a lock whose corresponding directory was already gone could remain indefinitely.

This change extends both cleanup paths to enumerate their expected lock-file patterns and attempt an exclusive acquisition. Successfully acquired locks are unheld and are deleted when the lock is disposed; locks held by active dashboard processes and files outside the expected naming pattern remain untouched. Each dashboard also skips its own known lock instead of provoking an expected sharing violation.

Added focused tests covering abandoned locks, actively held locks, current dashboard locks, and unrelated temporary lock-file names. Also ran the nearest retention, active-run, and deletion-failure pruning tests.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20140

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20140"

Copilot AI 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.

🟢 Approval recommended

The cleanup is safely gated by exclusive lock acquisition and has focused regression coverage.

Pull request overview

Extends dashboard run pruning to remove stale, unheld lock files while preserving active locks.

Changes:

  • Deletes exclusively acquirable top-level run lock files.
  • Adds regression coverage for abandoned, active, and current-run locks.
File summaries
File Description
src/Aspire.Dashboard/ServiceClient/DashboardRunStore.cs Adds abandoned lock cleanup during pruning.
tests/Aspire.Dashboard.Tests/Model/DashboardDataSourceTests.cs Verifies only unheld locks are deleted.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

Copilot AI 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.

🟢 Approval recommended

The cleanup uses existing lock semantics and has focused coverage for abandoned, active, and current locks.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI 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.

🟢 Approval recommended

The cleanup is narrowly scoped and the affected behaviors have focused regression coverage.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI 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.

🟢 Approval recommended

The cleanup safely uses exclusive lock acquisition and is covered by focused tests.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 CI Failure Analysis: Transient Infrastructure Failure

The CI build failed due to transient infrastructure issues.

Failed jobs:

  • Tests / No-package tests (regular, Aspire.Hosting.RemoteHost.Tests, Hosting.RemoteHost, Hosting.RemoteHos... / Hosting.RemoteHost (windows-latest) — Job failed at the 'Build test project' step with a generic exit code 1 and no fetchable job logs. This matches the known recurring pattern of unrelated 'Build test project' failures (Hosting.RemoteHost among the affected jobs) seen across multiple PRs, unrelated to PR changes which only touch Aspire.Dashboard code. (transient-infra)
  • Tests / Package tests - Linux (class, Aspire.Templates.Tests, Templates-NUnit_NewUpAndBuildSupportProject... / Templates-NUnit_NewUpAndBuildSupportProjectTemplatesTests (ubuntu-latest) — Job failed at the 'Set up .NET Core' step with annotation 'read ECONNRESET', a transient network reset while downloading the SDK/runtime, unrelated to the PR's dashboard-only changes. (transient-infra)

If a rerun was not already requested automatically, visit the workflow run page to rerun the failed jobs manually.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants