all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Venkat <venkata@venkatamutyala.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH common] fix #8124: rest environment: retry reading worker UPID on EINTR
Date: Sat, 14 Nov 2026 07:55:44 +0000	[thread overview]
Message-ID: <20261114075544.3684889-1-venkata@venkatamutyala.com> (raw)

fork_worker waits for the newly forked worker to report its UPID by
reading from a pipe. The API daemons install a Perl SIGCHLD handler,
and Perl installs such handlers without SA_RESTART. If another worker
of the same process exits while the parent waits, the read fails with
EINTR, the buffer stays empty and the task start fails with "got no
worker upid - start worker failed", although the worker itself started
fine and is then killed.

This shows up when many tasks start and end on a node at the same
time, e.g. when creating several VMs in parallel through the API.

Retry the read on EINTR, like readline_nointr in PVE::Tools does.

The other reads of the handshake are not affected: the worker resets
SIGCHLD to default before reading the parent's OK, and the final read
of the control pipe in sync (CLI) mode only happens once the worker
has written its status or died.

Signed-off-by: Venkat <venkata@venkatamutyala.com>
---
 src/PVE/RESTEnvironment.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index 7c75272..88da491 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -687,8 +687,11 @@ sub fork_worker {
     POSIX::close($csync[0]);
 
     my $readbuf = '';
-    # sync with child (wait until child starts)
-    POSIX::read($psync[0], $readbuf, 4096);
+    # sync with child (wait until child starts), retry on EINTR (see bug #8124)
+    while (1) {
+        my $res = POSIX::read($psync[0], $readbuf, 4096);
+        last if defined($res) || ($! != EINTR);
+    }
 
     if (!$sync) {
         POSIX::close($psync[0]);
-- 
2.51.1




                 reply	other threads:[~2026-11-16 15:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261114075544.3684889-1-venkata@venkatamutyala.com \
    --to=venkata@venkatamutyala.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal