Skip to content

Commit 66c0e46

Browse files
committed
Don't block main thread on qube hanging shutdown
The merge request to core-admin already avoids the main problem, of a hanging shutdown blocking qubesd. This change avoids a hanging shutdown blocking the interaction with the qube manager For: QubesOS/qubes-issues#10648 Fixes: QubesOS/qubes-issues#10074 Requires: QubesOS/qubes-core-admin#807 Requires: QubesOS/qubes-core-admin-client#469
1 parent ff411c5 commit 66c0e46

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ X-Python3-Version: >= 3.4
2222
Package: qubes-manager
2323
Architecture: any
2424
Depends:
25-
python3-qubesadmin (>= 4.3.13),
25+
python3-qubesadmin (>= 4.3.33),
2626
python3-qubesimgconverter,
2727
python3-pyqt6,
2828
python3-pyinotify,

qubesmanager/qube_manager.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,20 @@ def run(self):
696696
self.msg = ("Error starting Qube!", str(ex))
697697

698698

699+
# pylint: disable=too-few-public-methods
700+
class ShutdownVMThread(common_threads.QubesThread):
701+
def __init__(self, vm, force: bool = False, wait: bool = False):
702+
super().__init__(vm)
703+
self.force = force
704+
self.wait_end = wait # wait() is callable, let's not interfere.
705+
706+
def run(self):
707+
try:
708+
self.vm.shutdown(force=self.force, wait=self.wait_end)
709+
except exc.QubesException as ex:
710+
self.msg = ("Error starting Qube!", str(ex))
711+
712+
699713
# pylint: disable=too-few-public-methods
700714
class UpdateVMsThread(common_threads.QubesThread):
701715
def run(self):
@@ -1660,9 +1674,15 @@ def shutdown_vm(self, vm, force=False, check_time=vm_restart_check_timeout,
16601674

16611675
force = True
16621676
for connected_vm in connected_vms:
1663-
connected_vm.shutdown(force=force)
1677+
thread = ShutdownVMThread(connected_vm, force=force)
1678+
self.threads_list.append(thread)
1679+
thread.finished.connect(self.clear_threads)
1680+
thread.start()
16641681

1665-
vm.shutdown(force=force)
1682+
thread = ShutdownVMThread(vm, force=force, wait=True)
1683+
self.threads_list.append(thread)
1684+
thread.finished.connect(self.clear_threads)
1685+
thread.start()
16661686
except exc.QubesException as ex:
16671687
QMessageBox.warning(
16681688
self,

rpm_spec/qmgr.spec.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ URL: https://www.qubes-os.org
1010
Requires: python%{python3_pkgversion}
1111
Requires: python%{python3_pkgversion}-pyqt6
1212
Requires: python%{python3_pkgversion}-inotify
13-
Requires: python%{python3_pkgversion}-qubesadmin >= 4.3.13
13+
Requires: python%{python3_pkgversion}-qubesadmin >= 4.3.33
1414
Requires: python%{python3_pkgversion}-qubesimgconverter
1515
Requires: python%{python3_pkgversion}-qasync
1616
Requires: python%{python3_pkgversion}-pyxdg

0 commit comments

Comments
 (0)