* [PATCH manager] fix #4986: jobs: do not get stuck if the task log is missing
@ 2026-10-03 15:38 Michal Fox
2026-10-06 12:41 ` applied: " Fiona Ebner
0 siblings, 1 reply; 2+ messages in thread
From: Michal Fox @ 2026-10-03 15:38 UTC (permalink / raw)
To: pve-devel
When the scheduler checks whether the last run of a job has finished,
it dies if the task log of that run does not exist. The job is then
skipped with 'could not update job state, skipping - no such task' on
every iteration, so it never runs again until its state file is
cleaned up manually.
The task log can be gone, for example after a crash. If the task is
not running anymore, treat it as stopped with an error status instead,
so that the job gets scheduled again, like Proxmox Backup Server does
since commit 48fbce07 ("fix #4895: scheduled jobs: ignore task-log not
found error").
The check now comes after the one whether the task is still running,
so a running task does not get marked as stopped.
Signed-off-by: Michal Fox <me@dualfroz.com>
---
Tested with a script that runs run_jobs() with a mocked jobs.cfg on a
job state whose task log does not exist: before, the job was skipped
with 'no such task' on every run, now it is marked as stopped and
started again, while a job whose task is still running stays started.
PVE/Jobs.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/PVE/Jobs.pm b/PVE/Jobs.pm
index 40caf257..75f87060 100644
--- a/PVE/Jobs.pm
+++ b/PVE/Jobs.pm
@@ -109,13 +109,15 @@ my $get_job_task_status = sub {
my ($task, $filename) = PVE::Tools::upid_decode($state->{upid}, 1);
die "unable to parse worker upid - $state->{upid}\n" if !$task;
- die "no such task\n" if !-f $filename;
my $pstart = PVE::ProcFSTools::read_proc_starttime($task->{pid});
if ($pstart && $pstart == $task->{pstart}) {
return; # still running
}
+ # the task log might be gone, e.g. after a crash, do not let that block the job forever
+ return "task log not found" if !-f $filename;
+
return PVE::Tools::upid_read_status($state->{upid});
};
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* applied: [PATCH manager] fix #4986: jobs: do not get stuck if the task log is missing
2026-10-03 15:38 [PATCH manager] fix #4986: jobs: do not get stuck if the task log is missing Michal Fox
@ 2026-10-06 12:41 ` Fiona Ebner
0 siblings, 0 replies; 2+ messages in thread
From: Fiona Ebner @ 2026-10-06 12:41 UTC (permalink / raw)
To: pve-devel, Michal Fox
On Sat, 03 Oct 2026 15:38:20 +0000, Michal Fox wrote:
> When the scheduler checks whether the last run of a job has finished,
> it dies if the task log of that run does not exist. The job is then
> skipped with 'could not update job state, skipping - no such task' on
> every iteration, so it never runs again until its state file is
> cleaned up manually.
>
> The task log can be gone, for example after a crash. If the task is
> not running anymore, treat it as stopped with an error status instead,
> so that the job gets scheduled again, like Proxmox Backup Server does
> since commit 48fbce07 ("fix #4895: scheduled jobs: ignore task-log not
> found error").
>
> [...]
Applied, thanks! I switched to using PVE::File::file_exists() for the
existence check and also made the scheduler issue an explicit warning.
[1/1] fix #4986: jobs: do not get stuck if the task log is missing
commit: ac0c87dd37115e3046cbfa5756f2a02fc659e8cd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-06 12:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-03 15:38 [PATCH manager] fix #4986: jobs: do not get stuck if the task log is missing Michal Fox
2026-10-06 12:41 ` applied: " Fiona Ebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox