[pbs-devel] applied: [PATCH proxmox-backup] tape/pool_writer: do not unwrap on channel send

Dietmar Maurer dietmar at proxmox.com
Tue May 11 09:08:28 CEST 2021


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 at 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);
> +                }
>               }
>           });
>   





More information about the pbs-devel mailing list