D25623: Fix crash when cups returns jobs with duplicate id

Marcel Martin noreply at phabricator.kde.org
Mon Dec 2 10:25:57 GMT 2019


marcelm added a comment.


  Perhaps this is helpful. It appears that the CUPS queue (or a cached version of it) is stored in `/var/cache/cups/job.cache`. By editing it manually, you can remove duplicate entries but also create them for testing.
  
  My queue with duplicate ids, which led to plasma crashing, looked like this:
  
    $ lpstat -R                                                                                                                                                                                                                                                                
      0 MyPrinter-148         marcel           60416 2016-05-24T16:35:53 CEST                                                                                                                                                                                                                   
      1 MyPrinter-148         marcel           60416 2016-05-24T16:35:53 CEST                                                                                                                                                                                                                   
      2 MyPrinter-188         marcel           72704 2017-08-29T17:49:47 CEST                                                                                                                                                                                                                   
      3 MyPrinter-188         marcel           72704 2017-08-29T17:49:47 CEST                                                                                                                                                                                                                   
  
  Both job 148 and 188 had duplicated sections in the `job.cache` file. While CUPS is not running, I edited the file and removed the duplicate sections. After re-starting CUPS, only a single copy of each job remained in `lpstat -R` output.
  
  To reproduce the duplicate ids, print a document but keep it in "held" state so that the job stays in the queue: `lpr -PMyPrinter -q document.pdf`. Find out the job id (with `lpstat` or similar). Then stop cups, edit the `job.cache` and duplicate the section in that file corresponding to the just printed job (probably at the end of the file). This is how one of those sections looks:
  
    <Job 257>
    State 4
    Created 1575280039
    Priority 50
    Username marcel
    Name document.pdf
    Destination MyPrinter
    DestType 0
    KOctets 393
    NumFiles 1
    File 1 application/pdf 0
    </Job>
  
  After starting CUPS, that job will also appear duplicated when inspecting the queue with `lpstat -R`.
  
  I still don’t know how this can happen without manually mucking around with `job.cache`, but the above at least reproduces the symptom.

REPOSITORY
  R363 Print Manager

REVISION DETAIL
  https://phabricator.kde.org/D25623

To: aacid, dantti
Cc: marcelm, fvogt, broulik, nicolasfella, kmaterka, kde-utils-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20191202/eedf9357/attachment-0001.html>


More information about the Kde-utils-devel mailing list