Skip to content

api/internal: invalidate SystemInfoCache on domain-add and domain-delete#825

Open
alex-schose wants to merge 1 commit into
QubesOS:mainfrom
alex-schose:patch-1
Open

api/internal: invalidate SystemInfoCache on domain-add and domain-delete#825
alex-schose wants to merge 1 commit into
QubesOS:mainfrom
alex-schose:patch-1

Conversation

@alex-schose

@alex-schose alex-schose commented Jun 9, 2026

Copy link
Copy Markdown

SystemInfoCache invalidates cls.cache for every event in vm_events
(via event_handler), but on_domain_add and on_domain_delete only
register / unregister the per-VM handlers - they never invalidate the cache
itself, and vm_events contains neither domain-add nor domain-delete.

As a result a freshly-created (or freshly-deleted) VM is missing from / stale
in the cached system_info until some other event happens to invalidate it.
While stale, qubes-qrexec-policy-daemon's internal.GetSystemInfo query
returns the old snapshot: a call naming a new VM logs
target '...' does not exist, using @default instead, and a deleted VM can
still be offered by a @default ask handler (e.g. qvm-copy).

Fix: invalidate the cache in both handlers, after (un)registering the per-VM
handlers. domain-add / domain-delete are app-level events; this is the
symmetric counterpart to how every vm_events entry already invalidates via
event_handler. Performance impact is negligible - these events are
infrequent relative to the per-VM events that already clear the cache.

Fixes QubesOS/qubes-issues#10911.

@marmarek

marmarek commented Jun 9, 2026

Copy link
Copy Markdown
Member

PipelineRefresh

@marmarek

marmarek commented Jun 9, 2026

Copy link
Copy Markdown
Member

PipelineRetry

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.35%. Comparing base (ccb5513) to head (01972b6).

Files with missing lines Patch % Lines
qubes/api/internal.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #825      +/-   ##
==========================================
- Coverage   70.46%   70.35%   -0.12%     
==========================================
  Files          61       61              
  Lines       14144    14087      -57     
==========================================
- Hits         9967     9911      -56     
+ Misses       4177     4176       -1     
Flag Coverage Δ
unittests 70.35% <0.00%> (-0.12%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

@andrewdavidwong

Copy link
Copy Markdown
Member

Fixes #10911.

You must add QubesOS/qubes-issues in front of #10911 because it's a different repo. The whole thing should look like this: Fixes QubesOS/qubes-issues#10911.

@alex-schose

Copy link
Copy Markdown
Author

Done — updated to Fixes QubesOS/qubes-issues#10911.

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.

SystemInfoCache.on_domain_add does not invalidate the cache -> freshly-created VMs are invisible to qrexec policy until the next invalidating event

3 participants