From: Zdenek Dohnal Date: Tue, 15 Jul 2025 11:16:52 +0000 (+0200) Subject: scheduler: Fix cleaning jobs by loading times when needed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2.4.x;p=thirdparty%2Fcups.git scheduler: Fix cleaning jobs by loading times when needed Currently if we load jobs from job.cache, we don't set correct times for `history_time` and `file_time`, resulting them in being 0 and the jobs avoids the cleanup by cupsd when needed, leading into eating up memory space. It happens because none of the functions which set those job members are not called - `cupsdSetJobState()` is used when changing job states, `cupsdUpdateJobs()` during partial reload and `cupsdLoadJob()` is guarded by condition in `load_job_cache()`. The fix is to change conditional in `load_job_cache()` which will cause loading of the job if cupsd is set to clean up job history, or if cupsd should clean up job files and the job still has some. --- diff --git a/CHANGES.md b/CHANGES.md index c21e7f27eb..a8dee9ef58 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ Changes in CUPS v2.4.13 (YYYY-MM-DD) - Fixed parsing of real numbers in PPD compiler source files (Issue #1263) - Fixed scheduler freezing with zombie clients (Issue #1264) - Fixed support for the server name in the ErrorLog filename (Issue #1277) +- Fixed job cleanup after daemon restart (Issue #1315) Changes in CUPS v2.4.12 (2025-04-08) diff --git a/scheduler/job.c b/scheduler/job.c index 58c7df462a..620a2dd42c 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -4409,7 +4409,8 @@ load_job_cache(const char *filename) /* I - job.cache filename */ cupsArrayAdd(ActiveJobs, job); else if (job->state_value > IPP_JOB_STOPPED) { - if (!job->completed_time || !job->creation_time || !job->name || !job->koctets) + if (!job->completed_time || !job->creation_time || !job->name || !job->koctets || + JobHistory < INT_MAX || (JobFiles < INT_MAX && job->num_files)) { cupsdLoadJob(job); unload_job(job);