MaxJobTime=0 results in jobs being cancelled immediately instead of never
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CUPS |
Fix Released
|
Unknown
|
|||
cups (Debian) |
Fix Released
|
Unknown
|
|||
cups (Ubuntu) |
Fix Released
|
Medium
|
Dan Streetman | ||
Xenial |
Fix Released
|
Medium
|
Dariusz Gadomski | ||
Bionic |
Fix Released
|
Medium
|
Dariusz Gadomski | ||
Cosmic |
Fix Released
|
Medium
|
Dariusz Gadomski | ||
Disco |
Fix Released
|
Medium
|
Dan Streetman |
Bug Description
[Impact]
Setting the cupsd option MaxJobTime to 0 should make the server wait indefinitely for the job to be ready for print. Instead, after updating job-cancel-after option with MaxJobTime=0 value it results in immediate cancelling.
This leads to problems with using filters that take some time to process - the user needs to set MaxJobTime to a ridiculously high value to ensure the job is not going to get cancelled instead of just disabling the cancelling timeout.
[Test Case]
1. Add MaxJobTime 0 option to /etc/cups/
2. Setup a filter that takes at least several seconds to process.
(please find a sample imagetopdf wrapper introducing 5s delay)
3. Submit a print job matching the filter, e.g.
lp -d my-printer someimage.jpg # jpg uses the imagetopdf wrapper
Expected result:
The job is printed after the 5s delay.
Actual result:
The job is cancelled.
[Regression Potential]
The scope of the change is limited to fixing the MaxJobTime handling
in scheduler/job.c and scheduler/
difference in behavior except for the special value of MaxJobTime=0.
[Other Info]
Original bug description:
When using CUPS filters, these filters can take a few seconds to complete.
In this case no documents are allowed to be lost on printing failures, so we used to set "MaxJobTime 0" in cupsd.conf which worked on Ubuntu 14.04.
With cups on 18.04, you get the following message in /var/log/
I [12/Nov/
Then, the job is deleted and lost.
"MaxJobTime 0" is documented as "indefinite wait", but apparently cups treats is as "wait almost not at all".
This issue appears to have also been filed upstream: https:/
Temporary workaround is to set the MaxJobTime to a very large value instead (e.g. 3 years)
Trusty is not affected by this bug.
description: | updated |
Changed in cups (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cups: | |
status: | Unknown → New |
Changed in cups (Ubuntu Disco): | |
assignee: | nobody → Dariusz Gadomski (dgadomski) |
Changed in cups (Ubuntu Cosmic): | |
assignee: | nobody → Dariusz Gadomski (dgadomski) |
Changed in cups (Ubuntu Bionic): | |
assignee: | nobody → Dariusz Gadomski (dgadomski) |
Changed in cups (Ubuntu Xenial): | |
assignee: | nobody → Dariusz Gadomski (dgadomski) |
Changed in cups (Ubuntu Cosmic): | |
importance: | Undecided → Medium |
Changed in cups (Ubuntu Bionic): | |
importance: | Undecided → Medium |
Changed in cups (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in cups (Ubuntu Cosmic): | |
status: | New → In Progress |
Changed in cups (Ubuntu Disco): | |
status: | Confirmed → In Progress |
Changed in cups (Ubuntu Bionic): | |
status: | New → In Progress |
Changed in cups (Ubuntu Xenial): | |
status: | New → In Progress |
Changed in cups (Ubuntu Trusty): | |
status: | New → Invalid |
description: | updated |
tags: | added: sts-sponsor sts-sponsor-ddstreet |
Changed in cups (Ubuntu Disco): | |
assignee: | Dariusz Gadomski (dgadomski) → Dan Streetman (ddstreet) |
Changed in cups (Debian): | |
status: | Unknown → New |
Changed in cups (Debian): | |
status: | New → Fix Released |
Changed in cups: | |
status: | New → Fix Released |
no longer affects: | cups (Ubuntu Trusty) |
tags: | removed: sts-sponsor sts-sponsor-ddstreet |
I enabled "debug2" log level and tested again. I found the following entries in the log: 2018:08: 22:25 +0100] cupsdCheckJobs: 1 active jobs, sleeping=0, ac-power=-1, reload=0, curtime=1542698545 2018:08: 22:25 +0100] cupsdCheckJobs: Job 75 - dest="hvitcpdf", printer=(nil), state=3, cancel_time=0, hold_until= 1542698845, kill_time=0, pending_cost=0, pending_timeout=0 2018:08: 22:35 +0100] cupsdCheckJobs: 1 active jobs, sleeping=0, ac-power=-1, reload=0, curtime=1542698555 2018:08: 22:35 +0100] cupsdCheckJobs: Job 75 - dest="hvitcpdf", printer= 0x55faadd92e00, state=5, cancel_ time=1542698545 , hold_until= 1542698845, kill_time=0, pending_cost=0, pending_timeout=0
d [20/Nov/
d [20/Nov/
[...]
d [20/Nov/
d [20/Nov/
In the first run of cupsdCheckJobs, the cancel_time of the job is zero, which means to wait indefinitely as expected. In the second run, the cancel_time has been updated to the time of the creation of the job which is wrong.
There is now an individual cancellation time for each job, which is initialized to MaxJobTime if it's not explicitely set. See printers.c around line 3450: ("job-cancel- after", p->num_options, p->options)) p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, after-default" , MaxJobTime);
---
if (!cupsGetOption
ippAddInteger(
"job-cancel-
---
So if MaxJobTime is set to 0 - which means never to kill the job - the default for job-cancel-after is set to 0 - which means to kill the job immediately. So I guess there is a missing check for the special value of 0.