From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 81118CFFE
 for <pve-devel@lists.proxmox.com>; Wed, 20 Sep 2023 13:23:28 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 6A14314EA9
 for <pve-devel@lists.proxmox.com>; Wed, 20 Sep 2023 13:23:28 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Wed, 20 Sep 2023 13:23:27 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6A3B048440;
 Wed, 20 Sep 2023 13:23:27 +0200 (CEST)
Message-ID: <6ff59a25-0401-41c4-8352-379bc0bafeb3@proxmox.com>
Date: Wed, 20 Sep 2023 13:23:26 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Fiona Ebner <f.ebner@proxmox.com>
References: <20230912091617.26590-1-f.ebner@proxmox.com>
From: Dominik Csapak <d.csapak@proxmox.com>
In-Reply-To: <20230912091617.26590-1-f.ebner@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.011 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [qemuserver.pm, proxmox.com]
Subject: Re: [pve-devel] [PATCH qemu-server 1/3] fix #2816: restore: remove
 timeout when allocating disks
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 20 Sep 2023 11:23:28 -0000

comment inline:

On 9/12/23 11:16, Fiona Ebner wrote:
> 10 minutes is not long enough when disks are large and/or network
> storages are used when preallocation is not disabled. The default is
> metadata preallocation for qcow2, so there are still reports of the
> issue [0][1]. If allocation really does not finish like the comment
> describing the timeout feared, just let the user cancel it.
> 
> Also note that when restoring a PBS backup, there is no timeout for
> disk allocation, and there don't seem to be any user complaints yet.
> 
> The 5 second timeout for receiving the config from vma is kept,
> because certain corruptions in the VMA header can lead to the
> operation hanging there.
> 
> There is no need for the $tmp variable before setting back the old
> timeout, because that is at least one second, so we'll always be able
> to set the $oldtimeout variable to undef in time in practice.
> Currently, there shouldn't even be an outer timeout in the first
> place, because the only call path leading to here is via the create
> API (also used by qmrestore), both of which don't set a timeout.
> 
> [0]: https://forum.proxmox.com/threads/126825/
> [1]: https://forum.proxmox.com/threads/128093/
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>   PVE/QemuServer.pm | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index bf1de179..05283562 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -7483,14 +7483,11 @@ sub restore_vma_archive {
>   		$devinfo->{$devname} = { size => $size, dev_id => $dev_id };
>   	    } elsif ($line =~ m/^CTIME: /) {
>   		# we correctly received the vma config, so we can disable
> -		# the timeout now for disk allocation (set to 10 minutes, so
> -		# that we always timeout if something goes wrong)
> -		alarm(600);
> +		# the timeout now for disk allocation
> +		alarm($oldtimeout || 0);
> +		$oldtimeout = undef;


this part looks wrong to me, because AFAIU you want to disable the timeout
(by canceling the alarm), but what you do here is to set it to $oldtimeout
if that was set before?

i guess what we want to do here is:

----
alarm(0);
<... do stuff ...>
alarm($oldtimeout || 0);
$oldtimeout = undef;
----

?


>   		&$print_devmap();
>   		print $fifofh "done\n";
> -		my $tmp = $oldtimeout || 0;
> -		$oldtimeout = undef;
> -		alarm($tmp);
>   		close($fifofh);
>   		$fifofh = undef;
>   	    }