Skip to content

fix(autopause): stop container on idle instead of pausing - #951

Open
QwertyJacob wants to merge 1 commit into
winapps-org:mainfrom
QwertyJacob:fix/autopause-stop-container-on-idle
Open

fix(autopause): stop container on idle instead of pausing#951
QwertyJacob wants to merge 1 commit into
winapps-org:mainfrom
QwertyJacob:fix/autopause-stop-container-on-idle

Conversation

@QwertyJacob

Copy link
Copy Markdown

Summary of Changes

This PR updates the AUTOPAUSE functionality in bin/winapps to stop (docker compose stop / podman-compose stop / virsh shutdown) idle virtual machines rather than pausing (docker compose pause / virsh suspend).

Problem Addressed

When AUTOPAUSE="on" triggers after the idle timeout:

  1. Previously, winapps executed docker compose pause. In Docker, pause uses Linux cgroups freezer to freeze process execution in memory. This keeps the container listed as Up (Paused) in docker ps and leaves all host RAM allocated.
  2. More critically, for QEMU/KVM virtual machines (such as dockur/windows), freezing QEMU with cgroups freezer breaks clock/timer synchronization between host KVM and guest vCPUs. This causes QEMU helper threads to spin continuously at ~150% host CPU load in kernel space, causing severe host CPU overheating and maximum fan speeds.

Solution

  • Replaced pause with stop (docker compose stop, podman-compose stop) and virsh shutdown when SUSPEND_WINDOWS is triggered in waCheckIdle.
  • Updated notification text to: Stopping Windows due to inactivity.
  • When stop is called, the VM gracefully shuts down, dropping host CPU usage to 0% and releasing host RAM completely.
  • winapps already natively handles booting from an exited container status in waCheckContainerRunning (docker compose start), so next time a user opens any WinApp shortcut, Windows boots up automatically and transparently.

When AUTOPAUSE is triggered, winapps previously called 'docker compose pause' (or podman/libvirt suspend equivalents).

For QEMU/KVM virtual machines (such as dockur/windows), freezing QEMU with cgroups freezer breaks clock synchronization between host KVM and guest vCPUs, causing QEMU threads to spin continuously at ~150% host CPU load. Additionally, 'docker ps' still lists the container as 'Up (Paused)', leaving host RAM and CPU allocated.

Changing the idle action from 'pause' to 'stop' (and 'virsh shutdown') cleanly stops the VM, drops CPU usage to 0%, releases host RAM, and allows winapps to seamlessly restart the VM on the next application invocation.
@oskardotglobal

Copy link
Copy Markdown
Member

I'll have to investigate this. Can you please

  • sign off your commit
  • confirm that you experienced the overheating issue personally
  • and confirm whether this pull request was AI-generated in accordance to our Contribution Policy

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.

2 participants