public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-storage] partially-fix #7840: storage: read import output until 'ready'
Date: Wed,  7 Oct 2026 11:41:11 +0200	[thread overview]
Message-ID: <20261007094111.731097-1-a.bied-charreton@proxmox.com> (raw)

volume_import_start() spawns `pvesm import`, merges the subprocess'
stdout and stderr into one stream, and took the first line read from it
as the readiness signal. Any unrelated output the child emits first was
therefore mistaken for "ready", and the socket path was returned to the
caller before the child has bound and listened on it.

Read lines until one is exactly "ready", passing the earlier ones
through, and fail explicitly if the child reached EOF first.

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7840
Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 src/PVE/Storage.pm | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
index 64ea9da..60b5dcc 100755
--- a/src/PVE/Storage.pm
+++ b/src/PVE/Storage.pm
@@ -2214,14 +2214,19 @@ sub volume_import_start {
     my $cpid = open3($input, $info, $info, @$import)
         or die "failed to spawn disk-import child - $!\n";
 
-    my $ready;
+    my ($ready, $output) = (0, '');
     eval {
-        PVE::Tools::run_with_timeout(5, sub { $ready = <$info>; });
+        PVE::Tools::run_with_timeout(5, sub {
+            while (defined(my $line = <$info>)) {
+                return $ready = 1 if $line eq "ready\n";
+                $output .= $line;
+            }
+        });
     };
+    die "failed to read readiness from disk import child: $@\n$output" if $@;
+    die "disk import child exited before signalling readiness\n$output" if !$ready;
 
-    die "failed to read readyness from disk import child: $@\n" if $@;
-
-    print "$ready\n";
+    print "${output}ready\n";
 
     return {
         fh => $info,
-- 
2.47.3





                 reply	other threads:[~2026-10-07  9:41 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=20261007094111.731097-1-a.bied-charreton@proxmox.com \
    --to=a.bied-charreton@proxmox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal