[pve-devel] [PATCH storage] Use bigger timeouts for zfs operations

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Oct 1 12:28:44 CEST 2019


On October 1, 2019 12:17 pm, Fabian Ebner wrote:
> Seems like 'zfs destroy' can take longer than 5 seconds, see [0].
> I changed the timeout to 15 seconds and also changed the default
> timeout to 10 instead of 5 seconds, to be on the safe side
> for other commands like 'zfs create'.
> 
> [0]: https://forum.proxmox.com/threads/timeout-beim-l%C3%B6schen-des-entfernen-replikats-bei-entfernung-der-replikation.58467/

NAK, we have a 30s timeout for synchronous API requests that call this, 
and they might do more than 2 zfs_requests. we'd rather timeout and have 
time to do error handling, than finish successfully sometimes, and die 
without cleanup other times.

the real solution for this is to convert the remaining synchronous API 
calls that trigger storage operations to async ones, and switch the GUI 
over to use the new variants. we had previous discussions about this 
issue already. to implement it really nice, we'd need to things:
- tasks with structured return value (to implement async content listing 
  and similar operations, and make conversion of sync to async API calls 
  easier)
- light-weight / ephemeral tasks (not included in regular task 
  lists/log, cleaned up after final poll / 1 day after finishing / ...)

in case of the mentioned report, please investigate whether this call in 
'pvesr' context is wrongly treated as sync API call (i.e., is_worker 
should maybe return true for pvesr calls?)
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>  PVE/Storage/ZFSPoolPlugin.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
> index f66b277..3ce06be 100644
> --- a/PVE/Storage/ZFSPoolPlugin.pm
> +++ b/PVE/Storage/ZFSPoolPlugin.pm
> @@ -182,7 +182,7 @@ sub zfs_request {
>      my $msg = '';
>      my $output = sub { $msg .= "$_[0]\n" };
>  
> -    $timeout = PVE::RPCEnvironment->is_worker() ? 60*60 : 5 if !$timeout;
> +    $timeout = PVE::RPCEnvironment->is_worker() ? 60*60 : 10 if !$timeout;
>  
>      run_command($cmd, errmsg => "zfs error", outfunc => $output, timeout => $timeout);
>  
> @@ -346,7 +346,7 @@ sub zfs_delete_zvol {
>  
>      for (my $i = 0; $i < 6; $i++) {
>  
> -	eval { $class->zfs_request($scfg, undef, 'destroy', '-r', "$scfg->{pool}/$zvol"); };
> +	eval { $class->zfs_request($scfg, 15, 'destroy', '-r', "$scfg->{pool}/$zvol"); };
>  	if ($err = $@) {
>  	    if ($err =~ m/^zfs error:(.*): dataset is busy.*/) {
>  		sleep(1);
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list