<table><tr><td style="">marcelm added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D25623">View Revision</a></tr></table><br /><div><div><p>Perhaps this is helpful. It appears that the CUPS queue (or a cached version of it) is stored in <tt style="background: #ebebeb; font-size: 13px;">/var/cache/cups/job.cache</tt>. By editing it manually, you can remove duplicate entries but also create them for testing.</p>

<p>My queue with duplicate ids, which led to plasma crashing, looked like this:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="console" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><span style="color: #000080">$ lpstat -R                                                                                                                                                                                                                                                                </span>
<span style="color: #808080">  0 MyPrinter-148         marcel           60416 2016-05-24T16:35:53 CEST                                                                                                                                                                                                                   </span>
<span style="color: #808080">  1 MyPrinter-148         marcel           60416 2016-05-24T16:35:53 CEST                                                                                                                                                                                                                   </span>
<span style="color: #808080">  2 MyPrinter-188         marcel           72704 2017-08-29T17:49:47 CEST                                                                                                                                                                                                                   </span>
<span style="color: #808080">  3 MyPrinter-188         marcel           72704 2017-08-29T17:49:47 CEST                                                                                                                                                                                                                   </span></pre></div>

<p>Both job 148 and 188 had duplicated sections in the <tt style="background: #ebebeb; font-size: 13px;">job.cache</tt> 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 <tt style="background: #ebebeb; font-size: 13px;">lpstat -R</tt> output.</p>

<p>To reproduce the duplicate ids, print a document but keep it in "held" state so that the job stays in the queue: <tt style="background: #ebebeb; font-size: 13px;">lpr -PMyPrinter -q document.pdf</tt>. Find out the job id (with <tt style="background: #ebebeb; font-size: 13px;">lpstat</tt> or similar). Then stop cups, edit the <tt style="background: #ebebeb; font-size: 13px;">job.cache</tt> 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:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><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></pre></div>

<p>After starting CUPS, that job will also appear duplicated when inspecting the queue with <tt style="background: #ebebeb; font-size: 13px;">lpstat -R</tt>.</p>

<p>I still don’t know how this can happen without manually mucking around with <tt style="background: #ebebeb; font-size: 13px;">job.cache</tt>, but the above at least reproduces the symptom.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R363 Print Manager</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D25623">https://phabricator.kde.org/D25623</a></div></div><br /><div><strong>To: </strong>aacid, dantti<br /><strong>Cc: </strong>marcelm, fvogt, broulik, nicolasfella, kmaterka, kde-utils-devel<br /></div>