public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 container] fix #3478: abort container creation on arch detection timeout
@ 2021-07-22  7:54 Lorenz Stechauner
  2021-07-29 15:51 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenz Stechauner @ 2021-07-22  7:54 UTC (permalink / raw)
  To: pve-devel

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>
---
changes to v1:
* implemented feedback
* do not remove `\n` in error message

 src/PVE/LXC/Create.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
index 82d7ad9..e8233b6 100644
--- a/src/PVE/LXC/Create.pm
+++ b/src/PVE/LXC/Create.pm
@@ -52,10 +52,16 @@ sub detect_architecture {
 	return $arch;
     };
 
-    my $arch = eval { PVE::Tools::run_fork_with_timeout(5, $detect_arch) };
-    if (my $err = $@) {
+    my $arch = eval { PVE::Tools::run_fork_with_timeout(10, $detect_arch); };
+    my $err = $@;
+
+    if (!defined($arch) && !defined($err)) {
+	# on timeout
+	die "Architecture detection failed: timeout\n";
+    } elsif ($err) {
+	# any other error
 	$arch = 'amd64';
-	print "Architecture detection failed: $err\nFalling back to amd64.\n" .
+	print "Architecture detection failed: $err\nFalling back to $arch.\n" .
 	      "Use `pct set VMID --arch ARCH` to change.\n";
     } else {
 	print "Detected container architecture: $arch\n";
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: Re: [PATCH v2 container] fix #3478: abort container creation on arch detection timeout
  2021-07-22  7:54 [pve-devel] [PATCH v2 container] fix #3478: abort container creation on arch detection timeout Lorenz Stechauner
@ 2021-07-29 15:51 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-07-29 15:51 UTC (permalink / raw)
  To: Proxmox VE development discussion, Lorenz Stechauner

On 22/07/2021 09:54, 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>
> ---
> changes to v1:
> * implemented feedback
> * do not remove `\n` in error message
> 
>  src/PVE/LXC/Create.pm | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
>

applied, thanks!

Albeit I find the "why" behind just sketchy, if opening /bin/sh and reading 20 bytes
from it cannot be done in 5s something is seriously off IMO, but well, now they at
least get an actual error to point at that fact.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-29 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22  7:54 [pve-devel] [PATCH v2 container] fix #3478: abort container creation on arch detection timeout Lorenz Stechauner
2021-07-29 15:51 ` [pve-devel] applied: " Thomas Lamprecht

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