[PATCH proxmox-backup v4 3/3] fix #7400: proxy: self-heal corrupted job statefiles

Michael Köppl
2026-04-03T13:26:39Z

Update update_job_last_run_time to transition JobState::Unknown into
JobState::Created so the corrupted statefile is overwritten. In
addition, update the scheduling loops to actively overwrite corrupted
statefiles and return the time for the next scheduled run of the
affected job.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
src/bin/proxmox-backup-proxy.rs | 6 ++++--
src/server/jobstate.rs | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index c1fe3ac15..9a71d897d 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -31,7 +31,7 @@ use pbs_datastore::DataStore;
use proxmox_backup::{
server::{
auth::check_pbs_auth,
- jobstate::{self, Job},
+ jobstate::{self, Job, SCHEDULE_FALLBACK_OFFSET},
},
traffic_control_cache::{SharedRateLimit, TRAFFIC_CONTROL_CACHE},
};
@@ -564,6 +564,7 @@ async fn schedule_datastore_garbage_collection() {
Ok(time) => time,
Err(err) => {
eprintln!("could not get last run time of {worker_type} {store}: {err}");
+ let _ = jobstate::update_job_last_run_time(worker_type, &store);
continue;
}
};
@@ -936,7 +937,8 @@ fn check_schedule(worker_type: &str, event_str: &str, id: &str) -> bool {
Ok(time) => time,
Err(err) => {
eprintln!("could not get last run time of {worker_type} {id}: {err}");
- return false;
+ let _ = jobstate::update_job_last_run_time(worker_type, id);
+ proxmox_time::epoch_i64() - SCHEDULE_FALLBACK_OFFSET
}
};

diff --git a/src/server/jobstate.rs b/src/server/jobstate.rs
index 42660aa7a..3616981b4 100644
--- a/src/server/jobstate.rs
+++ b/src/server/jobstate.rs
@@ -159,7 +159,7 @@ pub fn update_job_last_run_time(jobtype: &str, jobname: &str) -> Result<(), Erro
state,
updated: Some(time),
},
- JobState::Unknown => bail!("cannot update last run time for unknown job state"),
+ JobState::Unknown => JobState::Created { time },
};
job.write_state()
}
--
2.47.3