Bug 552768 - cups leaves leftovers in /tmp
Summary: cups leaves leftovers in /tmp
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-printer
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 556548
TreeView+ depends on / blocked
 
Reported: 2010-01-06 04:19 UTC by Michal Jaegermann
Modified: 2010-02-05 01:37 UTC (History)
2 users (show)

Fixed In Version: 1.1.16-13.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 556548 (view as bug list)
Environment:
Last Closed: 2010-02-05 01:35:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
strace with a test print from system-config-printer leaving a link in /tmp/ (984.15 KB, text/plain)
2010-01-07 04:54 UTC, Michal Jaegermann
no flags Details
s-c-p attempting to check toner levels trace (1.14 MB, text/plain)
2010-01-08 18:43 UTC, Michal Jaegermann
no flags Details
trace from the first child of s-c-p above (92.12 KB, text/plain)
2010-01-08 18:43 UTC, Michal Jaegermann
no flags Details
trace from the second child of s-c-p above (7.64 KB, text/plain)
2010-01-08 18:44 UTC, Michal Jaegermann
no flags Details

Description Michal Jaegermann 2010-01-06 04:19:41 UTC
Description of problem:

Printing fills /tmp with links like /tmp/4b4259ddc961b.  In this particular case these are links to /etc/cups/ppd/HP-LaserJet-4250.ppd; one for every recent print job.  It would be nice if cups would bother to clean after itself.

AFAICT this started happening only after the recent cups update although an owner of this machine started to print on a printer different than before.

Version-Release number of selected component (if applicable):
cups-1.4.2-20.fc12.i686

Comment 1 Tim Waugh 2010-01-06 16:01:52 UTC
The problem is in fact some CUPS client or other, perhaps the GTK+ print dialog, perhaps system-config-printer, perhaps something else.

It would be really useful if you could pin-point exactly which application creates these files but does not delete them.

Comment 2 Michal Jaegermann 2010-01-06 16:58:29 UTC
> It would be really useful if you could pin-point exactly

Hm, I will try; but this may be not that obvious if you have not at least some ideas where to look.  That particular machine from the original report is "remote" for me.  OTOH I found somewhere else
/tmp/4b3923aaed969 -> /etc/cups/ppd/lpn.ppd
This is on a Fedora 11 machine with cups-1.4.2-20.fc11.x86_64 and a printing was done there which was later than a timestamp on this link.

Maybe this ia actually somehow related to bug 541882?  This is the same setup as the one from my comments in that bug and bug 550394.

Comment 3 Tim Waugh 2010-01-06 17:40:01 UTC
The only things I can think of off-hand are the GTK+ print dialog, system-config-printer, possibly system-config-printer-applet, and any application that implements its own print dialog that talks directly to CUPS.

Any application that uses libcups will end up creating these files when fetching a PPD for a queue.  Even e.g. 'lpoptions -l' will do this -- although we can rule that one out to start with as it definitely cleans up afterwards.

Yes, it's hard to track this sort of thing down.

Comment 4 Michal Jaegermann 2010-01-07 04:54:34 UTC
Created attachment 382148 [details]
strace with a test print from system-config-printer leaving a link in /tmp/

Well, this is not "exactly" but I managed to produce such leftover in /tmp
using system-config-printer-1.1.15-6.fc11.x86_64 on Fedora 11 installation.

A "printer" used here is a test one with a name of "t" and for DeviceURI using file:///var/tmp/out.ps configured as a "generic PostScript printer".  After
"Print Test Page" for this queue from s-c-p an alert "Submitted" shows up.
Closed that leaves one only with "Cancel" option although the job was already
printed.  Most of the time after "Cancel" and "Quit" s-c-p exits cleanly and
does 'unlink("/tmp/4b.....")' while at this as expected.

Once it hanged out on me such that 'kill' was not good enough.  It went away only after 'kill -9 ...'.  That left me with /tmp/4b44f8df4d82f -> /etc/cups/ppd/t.ppd and the trace attached is from this event.  This was from 'strace -ff ...' so children processes were recorded in separate files.  I do not have a good explanation for this hang.

A mechanism from the original report can be somewhat different; these "leftovers" were clearly produced by printing and not with s-c-p.  OTOH there there are errors like those from bug 541882 so this may cause aborts before unlink is called.

Does this help?

Comment 5 Tim Waugh 2010-01-07 12:14:07 UTC
(In reply to comment #4)
> Once it hanged out on me such that 'kill' was not good enough.  It went away
> only after 'kill -9 ...'.  That left me with /tmp/4b44f8df4d82f ->
> /etc/cups/ppd/t.ppd and the trace attached is from this event.  This was from
> 'strace -ff ...' so children processes were recorded in separate files.  I do
> not have a good explanation for this hang.

Bizarrely, the strace doesn't show any SIGKILL signal being received, only a seemingly normal exit.  I can see that it leaves the file there without cleaning it up, but I don't have any way of explaining that (other than that killing system-config-printer will leave temporary files around).

I can't see any code path in system-config-printer that leaves temporary files around, but perhaps I'm looking in the wrong place.

Comment 6 Michal Jaegermann 2010-01-07 16:15:27 UTC
> perhaps I'm looking in the wrong place.

One of traces from children ends up with 

read(5, 0x1d4fcb4, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
select(6, [5], NULL, [5], NULL) = ? ERESTARTNOHAND (To be restarted)
--- SIGINT (Interrupt) @ 0 (0) ---

but I do not see a smoking gun either.  If you think that this is of interest I can attache those too.  Maybe packed into a tar archive?  There is still six of those.

Sending job to a printer is needed for a link in question to show up.  I think that I would wait for bug 541882 to be cleared to see what effects on this one will be.  OTOH on a system I was experimenting with s-c-p I found another link of the same sort but this one created on "2009-12-28 14:31" (which is before the latest cups update).  No guesses why this one is here.

On a system printing on HP-LaserJet-4250 timestamps on lefover links are the same as on "c0*" files in /var/spool/cups/.

Comment 7 Michal Jaegermann 2010-01-08 18:41:07 UTC
I have what it seems a reliable way to create lefover symlinks in /tmp using system-config-printer-1.1.15-6.fc12 and that indeed seems to related to bug 541882.  I added the following section in /etc/cups/printers.conf:

<Printer t>
Info testing
Location out here
MakeModel HP LaserJet 4250 Foomatic/Postscript
DeviceURI file:///var/tmp/out.ps
State Idle
StateTime 1262972202
Type 8400916
Filter application/vnd.cups-raw 0 -
Filter application/vnd.cups-postscript 100 foomatic-rip
Filter application/vnd.cups-pdf 0 foomatic-rip
Filter application/vnd.apple-pdf 25 foomatic-rip
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
Attribute marker-colors none,none
Attribute marker-levels 73,31
Attribute marker-names Black Cartridge HP Q5942X,Maintenance Kit HP 110V-Q5421A, 220V-Q5422A
Attribute marker-types tonerCartridge,fuser
Attribute marker-change-time 1262902702
</Printer>

and started cups again. Now system-config-printer shows a printer "t", and one can "print" on it with expected, and correct, results.  An attempt to check toner levels results in a backtrace familiar from bug 541882 and one is left with the next symlink pointing to /etc/cups/ppd/t.ppd.  Traces from three processes resulting from this operation are attached.

I wonder if it would be feasible to open that symlink, unlink it and use further on the resulting handle.  Then on error that would disappear without any leftovers.

Printing with 'lp -dt ...' or 'lpr -Pt ...' works fine but it does not create any links to /etc/cups/ppd/t.ppd.  OTOH if the owner of a machine in question is using some kind of a GUI to print (I am not sure what he does) and that in turn goes into a trouble of checking toner levels behind the scene that could be a good reason why these symlinks multiply in /tmp.  Just guessing here.

Comment 8 Michal Jaegermann 2010-01-08 18:43:03 UTC
Created attachment 382515 [details]
s-c-p attempting to check toner levels trace

Comment 9 Michal Jaegermann 2010-01-08 18:43:56 UTC
Created attachment 382517 [details]
trace from the first child of s-c-p above

Comment 10 Michal Jaegermann 2010-01-08 18:44:45 UTC
Created attachment 382518 [details]
trace from the second child of s-c-p above

Comment 11 Michal Jaegermann 2010-01-09 19:55:55 UTC
An update to system-config-printer-1.1.16-6.fc12 and associated libraries (see bug 541882) unfortunately does not change anything here.  I still can produce a leftover symlink in /tmp just by opening a configuration for an HP LaserJet 4250 printer; like the one from a comment #7 or a real one.

Comment 12 Tim Waugh 2010-01-18 17:30:51 UTC
I've spotted the place that causes it.  Thanks for helping out.

Also affects Fedora 11.

Comment 13 Fedora Update System 2010-01-18 17:45:29 UTC
system-config-printer-1.1.16-9.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/system-config-printer-1.1.16-9.fc11

Comment 14 Fedora Update System 2010-01-18 17:46:20 UTC
system-config-printer-1.1.16-9.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/system-config-printer-1.1.16-9.fc12

Comment 15 Michal Jaegermann 2010-01-18 18:04:44 UTC
(In reply to comment #12)
> I've spotted the place that causes it.  Thanks for helping out.

There is a catch, though.  I was able to create links in question with s-c-p but I noticed that originaly as leftovers from printing.  I asked a system owner how he prints and he replied "usually I hit a <Print> button in xdvi or gv". I could not get replicate the issue with my "simulated printing".

The guy is away for a while in this moment.  I will see what will happen when he will be back.

Comment 16 Fedora Update System 2010-01-19 19:33:41 UTC
system-config-printer-1.1.16-9.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-0755

Comment 17 Fedora Update System 2010-01-19 19:39:47 UTC
system-config-printer-1.1.16-9.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2010-0776

Comment 18 Fedora Update System 2010-01-22 22:34:23 UTC
system-config-printer-1.1.16-11.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2010-0776

Comment 19 Fedora Update System 2010-01-22 22:36:30 UTC
system-config-printer-1.1.16-11.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-0755

Comment 20 Fedora Update System 2010-01-27 01:03:13 UTC
system-config-printer-1.1.16-13.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-0755

Comment 21 Fedora Update System 2010-01-27 01:04:15 UTC
system-config-printer-1.1.16-13.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2010-0776

Comment 22 Fedora Update System 2010-02-05 01:34:27 UTC
system-config-printer-1.1.16-13.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2010-02-05 01:36:23 UTC
system-config-printer-1.1.16-13.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.