Solution to CUPS Claiming Print Job Completed Despite Printing Nothing

May 10, 2016, 1:42 p.m. Sysadmin

Cause

The system runs out of RAM

Solution

Kill RAM intensive processes, or use swap.

How Did I Run into This Problem?

I have installed CUPS on my Raspberry Pi. It was connected to a USB printer and made it accessible via my LAN. It had been working very well until the recent. In these few weeks, somehow the printer does not print.

I entered the CUPS web interface of my Raspberry Pi and tried printing a test page. Funny enough. It claimed that the print job was completed, despite that the printer did nothing.

Then I dig up /var/log/cups/access_log. Here is what's inside.

localhost - - [10/May/2016:14:37:12 +0800] "POST /printers/Canon_MG2400_series HTTP/1.1" 200 422 Print-Job successful-ok

It claimed that the print is a success. Obviously that's not true!

Then I dig up /var/log/cups/error_log. Unfortunately, there was nothing inside.

Then I started trying stuffs like:

None worked! :(

Then I figured out that there is something called LogLevel in CUPS config. I modified it as follows:

LogLevel debug

And I restarted CUPS. Then I noticed the following messages appeared in /var/log/cups/error_log:

D [10/May/2016:14:37:20 +0800] [Job 136] Error: /undefined in --setpagedevice--
...
D [10/May/2016:14:37:20 +0800] [Job 136] Last OS error: Cannot allocate memory
D [10/May/2016:14:37:20 +0800] [Job 136] GPL Ghostscript 9.05: Unrecoverable error, exit code 1
...
I [10/May/2016:14:37:22 +0800] [Job 136] Job completed.

What? Obviously something went wrong! How on the earth could the level of that message merely be a debug? I think that should be at least a warn! More importantly, how come it is called "Job completed"? I think that should be "Job Failed" instead! :<

After that, I increased the swap space. And remote printing starts working again. :D

Took me a few hours to figure that out. I couldn't find this solution in Google. That's why I blog about this. Hopefully someone somewhere would somehow find this blogpost helpful.

UPDATE: I've filed a bug report to the CUPS developers. Hopefully it will be fixed soon.


Comments

fung siu fai
Feb. 10, 2017, 5:30 p.m.

good. thanks for remind

Yassine
Aug. 13, 2016, 1:42 a.m.

I had the exact same problem on my Pi Zero, and adding a swap file solved it. Thank you!

View all comments