From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id E9AAE1FF135 for ; Thu, 02 Jul 2026 11:23:52 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D444D21495; Thu, 02 Jul 2026 11:23:51 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 09/15] task cache: include archive file path in error log messages Date: Thu, 2 Jul 2026 11:22:52 +0200 Message-ID: <20260702092258.174740-10-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260702092258.174740-1-l.wagner@proxmox.com> References: <20260702092258.174740-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: 1782984190356 X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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: AYFMY73NNOLY7BUHJ5HVXIHX3XUS6PWF X-Message-ID-Hash: AYFMY73NNOLY7BUHJ5HVXIHX3XUS6PWF 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 --- server/src/remote_tasks/task_cache.rs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/server/src/remote_tasks/task_cache.rs b/server/src/remote_tasks/task_cache.rs index 02be9ca1..c7057786 100644 --- a/server/src/remote_tasks/task_cache.rs +++ b/server/src/remote_tasks/task_cache.rs @@ -1065,8 +1065,10 @@ impl Iterator for TaskArchiveIterator<'_> { struct InnerTaskArchiveIterator { /// Archive files to read. files: Vec, - /// Archive iterator we are currently using, if any + /// Archive iterator we are currently using, if any. current: Option, + /// Archive file that is currently being iterated over, if any. + current_file: Option, } impl InnerTaskArchiveIterator { @@ -1075,6 +1077,7 @@ impl InnerTaskArchiveIterator { Self { files, current: None, + current_file: None, } } } @@ -1088,9 +1091,22 @@ impl Iterator for InnerTaskArchiveIterator { Some(current) => { let next = current.next(); if next.is_some() { - return next; + return next.map(|res| { + res.with_context(|| { + format!( + "failed to read from {file}", + file = self + .current_file + .as_ref() + .expect("self.current and self.current_file are both Some") + .path + .display() + ) + }) + }); } else { self.current = None; + self.current_file = None; } } None => 'inner: loop { @@ -1100,6 +1116,7 @@ impl Iterator for InnerTaskArchiveIterator { match next_file.iter() { Ok(Some(iter)) => { self.current = Some(iter); + self.current_file = Some(next_file); break 'inner; } Ok(None) => { @@ -1107,7 +1124,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 +1310,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