Tag Archives: cups

When CUPS stops printing ~ lp: Too many active jobs

I got a nasty surprise this morning. I run a batch routine that generates a couple of thousand or so letters from E-Business Suite every night and then prints them – via CUPS –  to a series of networked printers. This has worked since the year dot. It has never let me down…. until that is, this morning when it let me down big style.

The first 500 letters were queued and then subsequently printed. The other 2500 were rejected by CUPS. (I should mention at this point that the letters are printed individually thus each letter generates a print job meaning 3000 or so print jobs should’ve been created and subsequently printed off).

After the first 500 letters went of to CUPS I started to see a message in my application log:

lp: Too many active jobs

I have never seen this message before. Well weird considering the number of print jobs that have gone through the system.

To cut a long story short the solution to my print problem was to change a parameter in cupsd.conf

By default CUPS will queue a maximum of 500 print jobs before rejecting further print requests. To quote directly from the CUPS manual :

The MaxJobs directive controls the maximum number of jobs that are kept in memory. Once the number of jobs reaches the limit, the oldest completed job is automatically purged from the system to make room for the new one. If all of the known jobs are still pending or active then the new job will be rejected.

Setting the maximum to 0 disables this functionality. The default setting is 500.

So I added MaxJobs 0 to my cupsd.conf file, restarted CUPS, did a fairly large scale test (about 1000 jobs sent) and all is well. I’ll update this post at some point as I’ve heard setting MaxJobs 0 can have unpleasant side effects in terms of Memory and CPU consumption.


How to Get your .Net Framework 4 C# application to use a proxy (with NTLM Authentication)

 I’d been working on an .net framework application that accessed a web resource internal to my organisation – ie, on the internal network where I work. There was no need to use a proxy. Then all of a sudden I was asked to re-write the code for this application to enable it to use a proxy (one that did NTLM authentication) as the resource was being scrapped and we were to buy other resources and access it over the web [via our proxy].

Here’s how I did it. Call this function from your class at a point before it starts making http requests and you should be okay. NB: this code works on our wholly Microsoft Windows network with NTLM authentication everywhere including the proxy server.

This works for me. Haven’t tried it with anything other than IE + XP + IAS though.

Best of luck.

static void setProxy()
    WebProxy proxy = (WebProxy)WebProxy.GetDefaultProxy();
    if(proxy.Address != null)
        proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
        WebRequest.DefaultWebProxy = new System.Net.WebProxy(proxy.Address, proxy.BypassProxyOnLocal, proxy.BypassList, proxy.Credentials);
I think this was the final code snippet.. Anyway, Give it a blast and let me know how you get on if you want to. Feel free to leave a comment. If you like it then link to it, if you don’t then tell a colleague.. 🙂