From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dietmar@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))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 4298F7AF83
 for <pbs-devel@lists.proxmox.com>; Tue, 11 May 2021 09:08:36 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 319D41E7B7
 for <pbs-devel@lists.proxmox.com>; Tue, 11 May 2021 09:08:36 +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) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 0D3941E7A7
 for <pbs-devel@lists.proxmox.com>; Tue, 11 May 2021 09:08:35 +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 D34C941B52
 for <pbs-devel@lists.proxmox.com>; Tue, 11 May 2021 09:08:28 +0200 (CEST)
To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>, Dominik Csapak <d.csapak@proxmox.com>
References: <20210510115409.16830-1-d.csapak@proxmox.com>
From: Dietmar Maurer <dietmar@proxmox.com>
Message-ID: <c0764d6c-a661-60ca-13fc-9a538ac75f95@proxmox.com>
Date: Tue, 11 May 2021 09:08:28 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.10.0
MIME-Version: 1.0
In-Reply-To: <20210510115409.16830-1-d.csapak@proxmox.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.073 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 POISEN_SPAM_PILL          0.1 Meta: its spam
 POISEN_SPAM_PILL_2        0.1 random spam to be learned in bayes
 POISEN_SPAM_PILL_4        0.1 random spam to be learned in bayes
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pbs-devel] applied: [PATCH proxmox-backup] tape/pool_writer: do
 not unwrap on channel send
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Tue, 11 May 2021 07:08:36 -0000

applied

On 5/10/21 1:54 PM, Dominik Csapak wrote:
> if the reader thread is already gone here, we panic here, resulting in
> a nondescript error message, so simply ignore/warn in that case and
> return gracefully
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>   src/tape/pool_writer/new_chunks_iterator.rs | 14 +++++++++++---
>   1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/tape/pool_writer/new_chunks_iterator.rs b/src/tape/pool_writer/new_chunks_iterator.rs
> index 56491356..64472902 100644
> --- a/src/tape/pool_writer/new_chunks_iterator.rs
> +++ b/src/tape/pool_writer/new_chunks_iterator.rs
> @@ -51,7 +51,7 @@ impl NewChunksIterator {
>                   loop {
>                       let digest = match chunk_iter.next() {
>                           None => {
> -                            tx.send(Ok(None)).unwrap();
> +                            let _ = tx.send(Ok(None)); // ignore send error
>                               break;
>                           }
>                           Some(digest) => digest?,
> @@ -67,7 +67,13 @@ impl NewChunksIterator {
>   
>                       let blob = datastore.load_chunk(&digest)?;
>                       //println!("LOAD CHUNK {}", proxmox::tools::digest_to_hex(&digest));
> -                    tx.send(Ok(Some((digest, blob)))).unwrap();
> +                    match tx.send(Ok(Some((digest, blob)))) {
> +                        Ok(()) => {},
> +                        Err(err) => {
> +                            eprintln!("could not send chunk to reader thread: {}", err);
> +                            break;
> +                        }
> +                    }
>   
>                       chunk_index.insert(digest);
>                   }
> @@ -75,7 +81,9 @@ impl NewChunksIterator {
>                   Ok(())
>               });
>               if let Err(err) = result {
> -                tx.send(Err(err)).unwrap();
> +                if let Err(err) = tx.send(Err(err)) {
> +                    eprintln!("error sending result to reader thread: {}", err);
> +                }
>               }
>           });
>