Skip to content

Commit 69550a0

Browse files
committed
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.
1 parent 2c78a69 commit 69550a0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Changes in CUPS v2.4.13 (YYYY-MM-DD)
2222
- Fixed parsing of real numbers in PPD compiler source files (Issue #1263)
2323
- Fixed scheduler freezing with zombie clients (Issue #1264)
2424
- Fixed support for the server name in the ErrorLog filename (Issue #1277)
25+
- Fixed job cleanup after daemon restart (Issue #1315)
2526

2627

2728
Changes in CUPS v2.4.12 (2025-04-08)

scheduler/job.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4409,7 +4409,8 @@ load_job_cache(const char *filename) /* I - job.cache filename */
44094409
cupsArrayAdd(ActiveJobs, job);
44104410
else if (job->state_value > IPP_JOB_STOPPED)
44114411
{
4412-
if (!job->completed_time || !job->creation_time || !job->name || !job->koctets)
4412+
if (!job->completed_time || !job->creation_time || !job->name || !job->koctets ||
4413+
JobHistory < INT_MAX || (JobFiles < INT_MAX && job->num_files))
44134414
{
44144415
cupsdLoadJob(job);
44154416
unload_job(job);

0 commit comments

Comments
 (0)