From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: Lorenz Stechauner <l.stechauner@proxmox.com>,
Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH container] fix #3478: abort container creation on arch detection timeout
Date: Thu, 22 Jul 2021 09:06:57 +0200 [thread overview]
Message-ID: <39cc40f3-374c-9370-3371-d7993b1324eb@proxmox.com> (raw)
In-Reply-To: <20210629135316.2095374-1-l.stechauner@proxmox.com>
ping
On 29.06.21 15:53, Lorenz Stechauner wrote:
> increased the timeout for detect_arch from 5 to 10 seconds.
>
> until now, on any error detect_architecture would fall back to amd64.
> to avoid falling back due to an timeout error this function now dies
> on timeout errors.
>
> additionally minor changes to the error messages have been made.
>
> Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
> ---
> src/PVE/LXC/Create.pm | 27 ++++++++++++++++++++++++---
> 1 file changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
> index 82d7ad9..0260578 100644
> --- a/src/PVE/LXC/Create.pm
> +++ b/src/PVE/LXC/Create.pm
> @@ -52,10 +52,31 @@ sub detect_architecture {
> return $arch;
> };
>
> - my $arch = eval { PVE::Tools::run_fork_with_timeout(5, $detect_arch) };
> - if (my $err = $@) {
> + my $arch;
> + my $status = 'error';
> + eval {
> + $arch = PVE::Tools::run_fork_with_timeout(10, $detect_arch);
> + if (!defined($arch)) {
> + if ($@) {
> + $status = 'timeout';
> + die $@;
> + } else {
> + $status = 'error';
> + die "unknown error\n";
> + }
> + }
> + $status = 'success';
> + };
> +
> + my $err = $@;
> + if ($status eq 'timeout') {
> + # on timeout
> + die "Architecture detection failed: $err"; # $err ends with \n
> + } elsif ($status eq 'error') {
> + # any other error
> $arch = 'amd64';
> - print "Architecture detection failed: $err\nFalling back to amd64.\n" .
> + print "Architecture detection failed: $err" . # $err ends with \n
> + "Falling back to $arch.\n" .
> "Use `pct set VMID --arch ARCH` to change.\n";
> } else {
> print "Detected container architecture: $arch\n";
prev parent reply other threads:[~2021-07-22 7:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-29 13:53 Lorenz Stechauner
2021-06-30 6:24 ` Fabian Grünbichler
2021-07-22 7:06 ` Lorenz Stechauner [this message]
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=39cc40f3-374c-9370-3371-d7993b1324eb@proxmox.com \
--to=l.stechauner@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