From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 1158B7ABC1 for ; Mon, 10 May 2021 13:54:11 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 04597179F7 for ; Mon, 10 May 2021 13:54:11 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id D45E4179EC for ; Mon, 10 May 2021 13:54:09 +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 A4990461A5 for ; Mon, 10 May 2021 13:54:09 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 10 May 2021 13:54:09 +0200 Message-Id: <20210510115409.16830-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.135 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] [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 11:54:11 -0000 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 --- 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