public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH v1 proxmox-backup 0/2] improve logging
@ 2026-04-30  9:17 Robert Obkircher
  2026-04-30  9:17 ` [PATCH v1 proxmox-backup 1/2] datastore: improve error if prune can't lock a snapshot for deletion Robert Obkircher
  2026-04-30  9:17 ` [PATCH v1 proxmox-backup 2/2] tree-wide: avoid struct-style debug representation of anyhow errors Robert Obkircher
  0 siblings, 2 replies; 3+ messages in thread
From: Robert Obkircher @ 2026-04-30  9:17 UTC (permalink / raw)
  To: pbs-devel

The first patch adds more context to a log message and the second one
replaces all uses of `:#?` with `:#`.

Robert Obkircher (2):
  datastore: improve error if prune can't lock a snapshot for deletion
  tree-wide: avoid struct-style debug representation of anyhow errors

 pbs-datastore/src/backup_info.rs | 6 +++---
 src/api2/admin/datastore.rs      | 8 ++++----
 src/server/pull.rs               | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.47.3





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 proxmox-backup 1/2] datastore: improve error if prune can't lock a snapshot for deletion
  2026-04-30  9:17 [PATCH v1 proxmox-backup 0/2] improve logging Robert Obkircher
@ 2026-04-30  9:17 ` Robert Obkircher
  2026-04-30  9:17 ` [PATCH v1 proxmox-backup 2/2] tree-wide: avoid struct-style debug representation of anyhow errors Robert Obkircher
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Obkircher @ 2026-04-30  9:17 UTC (permalink / raw)
  To: pbs-devel

Include the locking failure in the message (without causes to avoid
duplicate paths) and switch to a more readable representaiton of the
BackupDir.

Changes the error message from:

  2026-04-29T12:16:17+02:00: failed to remove dir "host/19/2026-04-29T10:16:13Z": while destroying snapshot 'BackupDir { store: "data3", ns: BackupNamespace { inner: [], len: 0 }, dir: BackupDir { group: BackupGroup { ty: Host, id: "19" }, time: 1777457773 }, backup_time_string: "2026-04-29T10:16:13Z" }'

to

  2026-04-29T16:38:24+02:00: failed to remove dir "host/28/2026-04-29T14:38:19Z": while destroying snapshot "/srv/aaaa/host/28/2026-04-29T14:38:19Z": unable to acquire snapshot lock "/run/proxmox-backup/locks/aaaa/host-28-2026\\x2d04\\x2d29T14\\x3a38\\x3a19Z"

This error is reproducible with PBS in a single-core VM by running
"Prune All" while starting many concurrent backups.

Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
 pbs-datastore/src/backup_info.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index d3871933b..1349650ac 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -886,9 +886,9 @@ impl BackupDir {
     pub(crate) fn destroy(&self, force: bool, backend: &DatastoreBackend) -> Result<(), Error> {
         let (_guard, _manifest_guard);
         if !force {
-            _guard = self
-                .lock()
-                .with_context(|| format!("while destroying snapshot '{self:?}'"))?;
+            _guard = self.lock().map_err(|err| {
+                format_err!("while destroying snapshot {:?}: {err}", self.full_path())
+            })?;
             _manifest_guard = self.lock_manifest()?;
         }
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v1 proxmox-backup 2/2] tree-wide: avoid struct-style debug representation of anyhow errors
  2026-04-30  9:17 [PATCH v1 proxmox-backup 0/2] improve logging Robert Obkircher
  2026-04-30  9:17 ` [PATCH v1 proxmox-backup 1/2] datastore: improve error if prune can't lock a snapshot for deletion Robert Obkircher
@ 2026-04-30  9:17 ` Robert Obkircher
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Obkircher @ 2026-04-30  9:17 UTC (permalink / raw)
  To: pbs-devel

Print all causes in a single, colon-separated line instead of using
the debug struct representation and no longer quote simple errors that
don't have a context.

Note that neither representation includes backtraces. Those are only
displayed with ':?'.

Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
 src/api2/admin/datastore.rs | 8 ++++----
 src/server/pull.rs          | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index a814c076c..1e0a78f3a 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -470,7 +470,7 @@ pub async fn delete_snapshot(
         let snapshot = datastore.backup_dir(ns, backup_dir)?;
         datastore
             .delete_snapshot(&snapshot)
-            .map_err(|err| format_err!("failed to delete snapshot - {err:#?}"))?;
+            .map_err(|err| format_err!("failed to delete snapshot - {err:#}"))?;
         Ok(Value::Null)
     })
     .await?
@@ -1096,7 +1096,7 @@ pub fn prune(
             if !keep {
                 if let Err(err) = datastore.delete_snapshot(backup_dir) {
                     warn!(
-                        "failed to remove dir {:?}: {err:#?}",
+                        "failed to remove dir {:?}: {err:#}",
                         backup_dir.relative_path()
                     );
                 }
@@ -1653,7 +1653,7 @@ pub fn upload_backup_log(
             datastore.add_blob(file_name.as_ref(), backup_dir, blob, &backend)
         })
         .await
-        .map_err(|err| format_err!("{err:#?}"))??;
+        .map_err(|err| format_err!("{err:#}"))??;
 
         // fixme: use correct formatter
         Ok(formatter::JSON_FORMATTER.format_data(Value::Null, &*rpcenv))
@@ -2118,7 +2118,7 @@ pub fn set_group_notes(
     let backup_group = datastore.backup_group(ns, backup_group);
     datastore
         .set_group_notes(notes, backup_group)
-        .map_err(|err| format_err!("failed to set group notes - {err:#?}"))?;
+        .map_err(|err| format_err!("failed to set group notes - {err:#}"))?;
     Ok(())
 }
 
diff --git a/src/server/pull.rs b/src/server/pull.rs
index 055a710fc..11a9a8ff9 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -1322,7 +1322,7 @@ async fn pull_group(
             log_sender
                 .log(
                     Level::WARN,
-                    format!("Failed to collect reusable chunk from last backup: {err:#?}"),
+                    format!("Failed to collect reusable chunk from last backup: {err:#}"),
                 )
                 .await?;
         }
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-30  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30  9:17 [PATCH v1 proxmox-backup 0/2] improve logging Robert Obkircher
2026-04-30  9:17 ` [PATCH v1 proxmox-backup 1/2] datastore: improve error if prune can't lock a snapshot for deletion Robert Obkircher
2026-04-30  9:17 ` [PATCH v1 proxmox-backup 2/2] tree-wide: avoid struct-style debug representation of anyhow errors Robert Obkircher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal