From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] tape/pool_writer: do not unwrap on channel send
Date: Mon, 10 May 2021 13:54:09 +0200 [thread overview]
Message-ID: <20210510115409.16830-1-d.csapak@proxmox.com> (raw)
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);
+ }
}
});
--
2.20.1
next reply other threads:[~2021-05-10 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 11:54 Dominik Csapak [this message]
2021-05-11 7:08 ` [pbs-devel] applied: " Dietmar Maurer
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=20210510115409.16830-1-d.csapak@proxmox.com \
--to=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 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.