I enabled "debug2" log level and tested again. I found the following entries in 
the log:
d [20/Nov/2018:08:22:25 +0100] cupsdCheckJobs: 1 active jobs, sleeping=0, 
ac-power=-1, reload=0, curtime=1542698545
d [20/Nov/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
[...]
d [20/Nov/2018:08:22:35 +0100] cupsdCheckJobs: 1 active jobs, sleeping=0, 
ac-power=-1, reload=0, curtime=1542698555
d [20/Nov/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

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:
---
if (!cupsGetOption("job-cancel-after", p->num_options, p->options))
ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"job-cancel-after-default", MaxJobTime);

---
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.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to cups in Ubuntu.
https://bugs.launchpad.net/bugs/1804576

Title:
  MaxJobTime=0 results in jobs being cancelled immediately instead of
  never

Status in CUPS:
  Unknown
Status in cups package in Ubuntu:
  Confirmed

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/cups/error_log 
whenever the filter takes a little longer:
  I [12/Nov/2018:14:43:26 +0100] [Job 18] Canceling stuck job after 0 seconds.

  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://github.com/apple/cups/issues/5438

  Temporary workaround is to set the MaxJobTime to a very large value
  instead (e.g. 3 years)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cups/+bug/1804576/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to