* [PATCH common] fix #8124: rest environment: retry reading worker UPID on EINTR
@ 2026-11-14 7:55 Venkat
0 siblings, 0 replies; only message in thread
From: Venkat @ 2026-11-14 7:55 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-16 15:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 7:55 [PATCH common] fix #8124: rest environment: retry reading worker UPID on EINTR Venkat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox