Handle SQLite errors during dashboard read cancellation - #20007
Handle SQLite errors during dashboard read cancellation#20007James Newton-King (JamesNK) wants to merge 1 commit into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20007Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20007" |
Tests selector9 / 99 PR test projects · 3 PR jobs · 1 advisory-only target, from 2 changed files. Selected PR test projects (9 / 99)
Selected PR jobs (3)
Advisory workflow impact (1)
How these were chosen — grouped by what changed🔧 📦 affected project 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
The behavior change is narrowly scoped, matches the PR description, and includes focused regression coverage for the new cancellation translation behavior.
Pull request overview
Fixes an intermittent Aspire Dashboard SQLite metrics failure where cancellation during statement preparation could surface a non-cancellation SQLite error (e.g., column-count mismatch) instead of normal cancellation semantics.
Changes:
- Update
SqliteTelemetryRepository.RunReadAsyncto translate anySqliteExceptionintoOperationCanceledExceptionwhen the caller’s cancellation token is already canceled. - Add a deterministic regression test asserting that non-
SQLITE_INTERRUPTSQLite errors are treated as cancellation when cancellation has been requested.
File summaries
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests/SqliteTelemetryPersistenceTests.cs | Adds regression coverage for translating non-SQLITE_INTERRUPT SQLite errors to cancellation. |
| src/Aspire.Dashboard/Otlp/Storage/SqliteTelemetryRepository.cs | Broadens cancellation translation logic from only SQLITE_INTERRUPT to any SqliteException when token is canceled. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Description
Fixes an intermittent dashboard metrics failure where canceling a SQLite read during statement preparation could surface an unrelated SQLite error instead of normal cancellation.
SQLite usually reports
SQLITE_INTERRUPTaftersqlite3_interrupt, but cancellation during statement preparation can produce another SQLite error, such asexpected 0 columns for '' but got 18. Treat any SQLite failure as cancellation when the caller's token is already canceled. SQLite failures continue to propagate normally when cancellation has not been requested.Adds deterministic regression coverage for a non-
SQLITE_INTERRUPTerror racing with cancellation.Validation:
SqliteTelemetryPersistenceTests: 19/19 passedChangeResource_MeterAndInstrumentNotOnNewResources_InstrumentCleared: passed after rebuild and in 25/25 repeated runsFixes #19742
Checklist
<remarks />and<code />elements on your triple slash comments?