From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id E98811FF0E1 for ; Mon, 13 Jul 2026 11:50:22 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3B919214AC; Mon, 13 Jul 2026 11:50:19 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager v2 09/15] task cache: include archive file path in error log messages Date: Mon, 13 Jul 2026 11:49:31 +0200 Message-ID: <20260713094937.151838-10-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260713094937.151838-1-l.wagner@proxmox.com> References: <20260713094937.151838-1-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783936169671 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.299 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: L3PEKWY224Z72T5RRGGAFKKNDAEZM3IB X-Message-ID-Hash: L3PEKWY224Z72T5RRGGAFKKNDAEZM3IB X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This should make any kind of troubleshooting much simpler. Signed-off-by: Lukas Wagner --- Notes: Changes since v1: - Avoid .expect() by storing the ArchiveFile and the ArchiveIterator together in a tuple (thx @ Dominik) server/src/remote_tasks/task_cache.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/server/src/remote_tasks/task_cache.rs b/server/src/remote_tasks/task_cache.rs index 655f018b..99c9b6ad 100644 --- a/server/src/remote_tasks/task_cache.rs +++ b/server/src/remote_tasks/task_cache.rs @@ -1065,8 +1065,8 @@ impl Iterator for TaskArchiveIterator<'_> { struct InnerTaskArchiveIterator { /// Archive files to read. files: Vec, - /// Archive iterator we are currently using, if any - current: Option, + /// Archive iterator we are currently using, and the corresponding archive file, if any. + current: Option<(ArchiveIterator, ArchiveFile)>, } impl InnerTaskArchiveIterator { @@ -1085,10 +1085,14 @@ impl Iterator for InnerTaskArchiveIterator { fn next(&mut self) -> Option { loop { match &mut self.current { - Some(current) => { + Some((current, file)) => { let next = current.next(); if next.is_some() { - return next; + return next.map(|res| { + res.with_context(|| { + format!("failed to read from {file}", file = file.path.display()) + }) + }); } else { self.current = None; } @@ -1099,7 +1103,7 @@ impl Iterator for InnerTaskArchiveIterator { match next_file.iter() { Ok(Some(iter)) => { - self.current = Some(iter); + self.current = Some((iter, next_file)); break 'inner; } Ok(None) => { @@ -1107,7 +1111,8 @@ impl Iterator for InnerTaskArchiveIterator { } Err(err) => { log::error!( - "could not create archive iterator while iteration over task archive files, skipping: {err:#}" + "could not create task archive iterator for {file}, skipping: {err:#}", + file = next_file.path.display() ) } } @@ -1292,7 +1297,7 @@ impl JournalIterator { .flat_map(|task| match task { Ok(task) => Some(task), Err(err) => { - log::error!("could not read task while iterating over archive file: {err:#}"); + log::error!("could not read task while iterating over journal file: {err:#}"); None } }) -- 2.47.3