* [pve-devel] [PATCH common 1/2] run with timeout: only special-case timeout error in list-context
@ 2023-08-30 13:07 Fiona Ebner
2023-08-30 13:07 ` [pve-devel] [PATCH common 2/2] run fork with timeout: only special case timeout error in list context Fiona Ebner
2023-08-30 14:45 ` [pve-devel] applied-series: [PATCH common 1/2] run with timeout: only special-case timeout error in list-context Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Fiona Ebner @ 2023-08-30 13:07 UTC (permalink / raw)
To: pve-devel
and not other errors too.
Fixes: a6aa0ae ("run with timeout: return if timeout happened in list context")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/Tools.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 50240c8..724fb69 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -143,7 +143,8 @@ sub run_with_timeout {
# this shouldn't happen anymore?
die "unknown error" if $sigcount && !$err; # seems to happen sometimes
- die $err if $err && !wantarray; # assume that user handles timeout err if called in list context
+ # assume that user handles timeout err if called in list context
+ die $err if $err && (!wantarray || !$got_timeout);
return wantarray ? ($res, $got_timeout) : $res;
}
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH common 2/2] run fork with timeout: only special case timeout error in list context
2023-08-30 13:07 [pve-devel] [PATCH common 1/2] run with timeout: only special-case timeout error in list-context Fiona Ebner
@ 2023-08-30 13:07 ` Fiona Ebner
2023-08-30 14:45 ` [pve-devel] applied-series: [PATCH common 1/2] run with timeout: only special-case timeout error in list-context Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2023-08-30 13:07 UTC (permalink / raw)
To: pve-devel
run_with_timeout() will treat a timeout error differently when called
in list context and run_fork_with_timeout() should do the same. Ensure
this by calling run_with_timeout() in list context if and only if
run_fork_with_timeout() is called in list context too.
Fixes: a6aa0ae ("run with timeout: return if timeout happened in list context")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/Tools.pm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 724fb69..2cfe93f 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1017,10 +1017,16 @@ sub run_fork_with_timeout {
$res = $child_res->{result};
$error = $child_res->{error};
};
+
my $got_timeout = 0;
+ my $wantarray = wantarray; # so it can be queried inside eval
eval {
if (defined($timeout)) {
- (undef, $got_timeout) = run_with_timeout($timeout, $readvalues);
+ if ($wantarray) {
+ (undef, $got_timeout) = run_with_timeout($timeout, $readvalues);
+ } else {
+ run_with_timeout($timeout, $readvalues);
+ }
} else {
$readvalues->();
}
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied-series: [PATCH common 1/2] run with timeout: only special-case timeout error in list-context
2023-08-30 13:07 [pve-devel] [PATCH common 1/2] run with timeout: only special-case timeout error in list-context Fiona Ebner
2023-08-30 13:07 ` [pve-devel] [PATCH common 2/2] run fork with timeout: only special case timeout error in list context Fiona Ebner
@ 2023-08-30 14:45 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-08-30 14:45 UTC (permalink / raw)
To: Proxmox VE development discussion, Fiona Ebner
Am 30/08/2023 um 15:07 schrieb Fiona Ebner:
> and not other errors too.
>
> Fixes: a6aa0ae ("run with timeout: return if timeout happened in list context")
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> src/PVE/Tools.pm | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>
applied both patches, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-30 14:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 13:07 [pve-devel] [PATCH common 1/2] run with timeout: only special-case timeout error in list-context Fiona Ebner
2023-08-30 13:07 ` [pve-devel] [PATCH common 2/2] run fork with timeout: only special case timeout error in list context Fiona Ebner
2023-08-30 14:45 ` [pve-devel] applied-series: [PATCH common 1/2] run with timeout: only special-case timeout error in list-context Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal