Skip to content

Removing disposable throws UUID KeyError on domain-shutdown event on qubesusbproxy/core3ext.py #10699

@ben-grande

Description

@ben-grande

Qubes OS release

Qubes OS 4.3

Brief summary

Introduced in QubesOS/qubes-app-linux-usb-proxy#51, @RealityAnomaly please take a look.

On domain-shutdown, there is del self.autoattach_locks[vm.uuid]. It throws KeyError: UUID('THE UUID'). It doesn't deal with the UUID not being the the lock collection anymore.

See real time 2026-02-17T05:48:09.322, or video time 0:25.

https://openqa.qubes-os.org/tests/167407/video?filename=video.webm

Or find it here: https://openqa.qubes-os.org/tests/167407/file/system_tests-tests.log

INFO:vm.disp3369:Removing volume root: qubes_dom0/vm-disp3369-root
INFO:vm.disp3369:Removing volume private: qubes_dom0/vm-disp3369-private
INFO:vm.disp3369:Removing volume volatile: qubes_dom0/vm-disp3369-volatile
INFO:vm.disp3369:Removing volume kernel: 6.18.4-1.4.fc41
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-27' coro=<DispVM.cleanup() done, defined at /usr/lib/python3.13/site-packages/qubes/vm/dispvm.py:946> exception=KeyError(UUID('2ea9c1f8-511f-4d54-83dc-ead4b1fcbef2'))>
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/qubes/vm/dispvm.py", line 962, in cleanup
    await self.kill()
  File "/usr/lib/python3.13/site-packages/qubes/vm/qubesvm.py", line 1702, in kill
    await waiter
  File "/usr/lib/python3.13/site-packages/qubes/vm/qubesvm.py", line 1612, in _domain_stopped_coro
    await self.fire_event_async("domain-shutdown")
  File "/usr/lib/python3.13/site-packages/qubes/events.py", line 243, in fire_event_async
    effect = task.result()
  File "/usr/lib/python3.13/site-packages/qubesusbproxy/core3ext.py", line 785, in on_domain_shutdown
    del self.autoattach_locks[vm.uuid]
        ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: UUID('2ea9c1f8-511f-4d54-83dc-ead4b1fcbef2')

Steps to reproduce

  1. Not always reproducible, openqa throwed this exception twice, although many disposables were deleted
  2. Shutdown a delete a qube (shutdown a disposable) several times until it triggers

Expected behavior

No unhandled exception.

Actual behavior

Unhandled KeyError for qube UUID that is not in the list.

Additional information

No response

Metadata

Metadata

Labels

C: usb proxyThis issue pertains to the USB proxy in Qubes OS.P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.affects-4.3This issue affects Qubes OS 4.3.diagnosedTechnical diagnosis of this issue has been performed.pr submittedA pull request has been submitted for this issue.

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions