From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C534F1FF141 for ; Fri, 13 Feb 2026 08:27:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A7A461EB06; Fri, 13 Feb 2026 08:28:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770928422; x=1771533222; darn=lists.proxmox.com; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=u+duK0riKU9XNjOPaBR3SpnI4TB0DPOV5NLAQ5eXCvI=; b=AVwrNhFd930LuQdfzrGftjlmiQB5YK4Txd2lgm0wpzHOe2xk7FH5fcvHdYFAX1x64j I5v/xwYidjb5ESvPXF7QINdxtVVX8sORGt6Dl7b2uNWk+VuXYKpOmkFv+ZnTeWjRaGai VxXwo1Fz7W+pJJlOZAh3vA3Kzz4bhUkKKEACwdztP5Zqb7fkSZ5aGhegy0+B2uWXHQB/ 6ecfArBMgMnWhaq0WxTzoR/QbMGUZbDfUcSn1Rgfm7B65WPhnZr1eM9g/BS5+HKomAa6 lh5RTr2NkvQ12k+YJAJRVUxPP2ReYK6tVBqaK+BOf6mVnXyhRYxXIBwaB032bgHP+H1g yoqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770928422; x=1771533222; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=u+duK0riKU9XNjOPaBR3SpnI4TB0DPOV5NLAQ5eXCvI=; b=NIKvr+rQ46Wm++MwitB9lvDlsahTyJ/UoE0iooN95a3X0nn2DoCDN4AfIq/eA8r9GA TF4WratHsQhtD7SCkn3zH8Rgdq8qurfovllKpAuNFdDGSF/kfTtSOh3V4WS3Zx2IX30x EuQ251RY9rUEI1aIxeN1I0JkQn5idGRsDuDmaLnPR6TEMzbhfW4whCZGHX6LHguD0/c+ BsPF+cu1DyA0gb+WdAPhscmgiAm0cbmR5yqwfRFCq+JaTGWP04kJiM6hriKXoa6hQlGk rDoCF1XENWlRtvNfHE0qoNfQQ+Lwiuxk3MmdIDDTBkmZ1kty/ZEmqoVcio3AqLFHtvYP kq3Q== X-Gm-Message-State: AOJu0YynUdIA0ILWDrfb+EMP7MN0MYi15cpn5mMylCG0P2zboQL50f+m 5N+yArZoh/Mn5+U+V9ddi4twfZIDeV7F7GNzS49OteAb77U6Ms6xhqjjkRt25tbwwrE= X-Gm-Gg: AZuq6aJUlyeKlUjvg6K5Kb3XTme3SbxSDCnWV3l3T8ACkG2hTGIvN+GLvRNZg+2z3X7 bKV9xei47XvaD04vuJ2S1yWPjFWfczQ+/EG0z1rhygsg4SnW3s51xpGngzXr6RJ9tomdYtXGmue SIwOUX25hz+mmeqA/CBZohdd4/sqjndKY1EwTaxdlCs00ATOXO0uFf+OspillKkHr+onI8ZXa2b I4VMyXrE4qUbhC9QFwaz9c7pMd3OR99zdZf7wQD+rVU3qQbk8U69EBSJrnebbfWcdECgM9zm23s rl3QbRS4GRIs6RWULr6hQs2jZze9x9JbOd585KobY62OKDe4So6m+c4rMu/CablXvNVBJrR3v8V XX+K21Bvpx0FJJoGXKjqBAsuHHP4SH7l1dPczj2NQ4erY7CIvHEXH27e0/pxVFl3RNK0UbuYB4Z UN2XOBYUw0GrVg3Gy4uJCZA51WqV1XbNlSWtinLJiGEDy4zL7jo2Ct X-Received: by 2002:a05:690c:ed3:b0:796:6784:82ca with SMTP id 00721157ae682-7979e845c1dmr1115417b3.30.1770928421569; Thu, 12 Feb 2026 12:33:41 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: [PATCH qemu-server v2] fix #7119: qm cleanup: wait for process exiting for up to 30 seconds From: Benjamin McGuire In-Reply-To: <20260210111612.2017883-1-d.csapak@proxmox.com> Date: Thu, 12 Feb 2026 15:33:30 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <2A05A694-4C6A-4C8F-96D6-CAC398D50835@gmail.com> References: <20260210111612.2017883-1-d.csapak@proxmox.com> To: Dominik Csapak X-Mailer: Apple Mail (2.3864.300.41.1.7) X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record X-MailFrom: jaminmc@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: 7QRI3BTRFA5OIBXFRHUT266PJBO6V55M X-Message-ID-Hash: 7QRI3BTRFA5OIBXFRHUT266PJBO6V55M X-Mailman-Approved-At: Fri, 13 Feb 2026 08:28:13 +0100 CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Tested-by: Benjamin McGuire > On Feb 10, 2026, at 6:15=E2=80=AFAM, Dominik Csapak = wrote: >=20 > When qmeventd detects a vm exiting, it starts 'qm cleanup' to cleanup > files, executing hookscripts, etc. >=20 > Since the vm process exits is sometimes not instant, wait up to 30 > seconds here to start the cleanup process instead of immediately > aborting if the pid still exits. This prevented executing the = hookscript > on the 'post-stop' phase. >=20 > This can be easily reproduced by e.g. passing through a usb device, > which delays the qemu process exit for a few seconds. >=20 > Signed-off-by: Dominik Csapak > --- > changes from v1: > * use correct while condition (time() is always >=3D $starttime) >=20 > original comment: >=20 > The 30 second timeout was arbitrarily chosen, but we could probably > start with something smaller, like 10 seconds? Could be adapted on > applying though. >=20 > In my (short) tests the usb passthrough part only adds a single = second, > but i can imagine different devices on other systems could block it = for > much longer. >=20 > src/PVE/CLI/qm.pm | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm > index bdae9641..16875ed2 100755 > --- a/src/PVE/CLI/qm.pm > +++ b/src/PVE/CLI/qm.pm > @@ -1101,8 +1101,19 @@ __PACKAGE__->register_method({ > 60, > sub { > my $conf =3D PVE::QemuConfig->load_config($vmid); > + > + # wait for some timeout until vm process exits, since = this might not be instant > + my $timeout =3D 30; > + my $starttime =3D time(); > my $pid =3D PVE::QemuServer::check_running($vmid); > - die "vm still running\n" if $pid; > + warn "vm still running - waiting up to $timeout = seconds\n" if $pid; > + > + while ($pid && (time() - $starttime) < $timeout) { > + sleep(1); > + $pid =3D PVE::QemuServer::check_running($vmid); > + } > + > + die "vm still running - aborting cleanup\n" if $pid; >=20 > # Rollback already does cleanup when preparing and = afterwards temporarily drops the > # lock on the configuration file to rollback the = volumes. Deactivating volumes here > --=20 > 2.47.3 >=20 >=20 >=20 >=20 >=20