]> git.proxmox.com Git - pve-container.git/commit
fix: shutdown: if lxc-stop fails, wait for socket closing with timeout
authorFriedrich Weber <f.weber@proxmox.com>
Wed, 25 Jan 2023 13:07:49 +0000 (14:07 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 17 Feb 2023 13:51:53 +0000 (14:51 +0100)
commit0d1d137eb10bd49fdcc12b397b2ed817d6ba2dc7
treeb232aaf744e54abe8bc7a797024a95a68690271b
parentfef1f4ddfd5efa0ea88bce507ad17a0f529412b5
fix: shutdown: if lxc-stop fails, wait for socket closing with timeout

When trying to shutdown a hung container with `forceStop=0` (e.g. via
the Web UI), the shutdown task may run indefinitely while holding a lock
on the container config. The reason is that the shutdown subroutine
waits for the LXC command socket to close, even if the `lxc-stop`
command has failed due to timeout. This prevents other tasks (such as a
stop task) from acquiring the lock. In order to stop the container, the
shutdown task has to be explicitly killed first, which is inconvenient.
This occurs e.g. when trying to shutdown a hung CentOS 7 container (with
systemd <v232) in a cgroupv2 environment.

This fix imposes a timeout on the socket polling operation if the
`lxc-stop` command has failed. Behavior in case `lxc-stop` succeeds is
unchanged. This reintroduces some behavior from b1bad293. The timeout
duration is the given shutdown timeout, meaning that the final task
duration in the scenario above is twice the shutdown timeout.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
src/PVE/LXC.pm