From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 12CCF1FF0F0 for ; Mon, 03 Aug 2026 19:22:03 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8DC40214B6; Mon, 03 Aug 2026 19:22:02 +0200 (CEST) From: Samuel Rufinatscha To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 0/1] fix #7590: apply timeout to QEMU start fork Date: Mon, 3 Aug 2026 19:21:51 +0200 Message-ID: <20260803172152.331208-1-s.rufinatscha@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785777706752 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.400 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_ASCII_DIVIDERS 0.8 Email that uses ascii formatting dividers and possible spam tricks KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: O7W5SR5VB65JC52JECETN4LRKVF5XC33 X-Message-ID-Hash: O7W5SR5VB65JC52JECETN4LRKVF5XC33 X-MailFrom: s.rufinatscha@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The qmstart task forks a child process that enters the VM scope, starts the helper processes and launches QEMU. qmstart then waits for the child to report success or failure. While regular starts already apply $start_timeout to the QEMU command, the wait for the forked child has no timeout. Statefile starts do not use the QEMU command timeout either, leaving both waits unbounded. Timeout handling currently: Start type QEMU command timeout forked startup timeout ------------------------------------------------------------------------------ regular $start_timeout none statefile none none Timeout handling after this series: Start type QEMU command timeout fork startup timeout ------------------------------------------------------------------------------ regular $start_timeout 2 * $start_timeout (account for helpers) statefile with --timeout N none N statefile without --timeout none 24 hours (as fallback) Regular starts retain the existing QEMU command timeout and is twice for the outer timeout to account for VM scope and helper setup. Statefile starts continue to have no separate QEMU command timeout. If --timeout N is specified, N is used as the deadline for the complete forked startup, otherwise a 24 hour fallback is used. Values can be changed if needed. Tested on a PVE 9.2 node: - the statefile/FIFO timeout released the configuration lock and left no QEMU process or VM scope behind, using the reproducer from [1] - the existing regular QEMU timeout still fired before the outer safeguard - an immediate QEMU startup error performed the same scope cleanup - successful startup and shutdown continued to work Note: the separate D-state waitpid() FIXME in run_fork_with_timeout() [2] concerns the timeout handling itself potentially blocking indefinitely and is therefore out of scope for this series. [0] https://lore.proxmox.com/pve-devel/20260625114500.159384-1-s.rufinatscha@proxmox.com/ [1] https://bugzilla.proxmox.com/show_bug.cgi?id=7590 [2] https://git.proxmox.com/?p=pve-common.git;a=blob;f=src/PVE/Tools.pm;h=8e7646dea43e092fc9ec76b493b418a7ca0eaee2;hb=5054082fe492429fc37574985c2ca812af9a3125#l604 Samuel Rufinatscha (1): fix #7590: qemu-server: apply timeout to QEMU start fork src/PVE/QemuServer.pm | 93 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 16 deletions(-) -- 2.47.3