qubes-app-shutdown-idle incorrectly monitors idleness and shuts down prematurely #9832
Labels
affects-4.2
This issue affects Qubes OS 4.2.
C: other
needs diagnosis
Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed.
P: default
Priority: default. Default priority for new issues, to be replaced given sufficient information.
Qubes OS release
Qubes OS 4.2
Brief summary
The way that idleness is monitored fails for apps that quickly map/unmap windows. For example, zoom does not open unless there's already an open window to prevent the idleness monitor from shutting everything down.
Steps to reproduce
Expected behavior
For zoom to open and the qube to be still running
Actual behavior
The qube immediately shuts down
Additional information
The function monitor_idleness in qubesidle/idleness_monitor.py does not work as intended. It assumes that all state changes go from idle->non-idle->idle but it is possible for state changes to happen and yet for the idle state to remain the same. There are possible race conditions. It it is possible for the function to return, shutting down the qube, with idleness of much less than 15 minutes.
What I see happen, if I remove the power off code, when launching zoom is roughly the following:
window map event -> state change -> detected idle (i.e. window has already been unmapped)
window unmap event -> state change -> detected idle (would power off at this point)
window map and unmap events -> state change -> detected idle (i.e. window quickly mapped/unmapped)
It would be better to check that it is both idle and it has been 15 minutes since the last time it was idle and not to assume that two consecutive idle checks means the system is idle.
The text was updated successfully, but these errors were encountered: