From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: [pbs-devel] applied: [PATCH proxmox-backup] tape/pool_writer: do not unwrap on channel send
Date: Tue, 11 May 2021 09:08:28 +0200 [thread overview]
Message-ID: <c0764d6c-a661-60ca-13fc-9a538ac75f95@proxmox.com> (raw)
In-Reply-To: <20210510115409.16830-1-d.csapak@proxmox.com>
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);
> + }
> }
> });
>
prev parent reply other threads:[~2021-05-11 7:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 11:54 [pbs-devel] " Dominik Csapak
2021-05-11 7:08 ` Dietmar Maurer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0764d6c-a661-60ca-13fc-9a538ac75f95@proxmox.com \
--to=dietmar@proxmox.com \
--cc=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox