[Printing-architecture] printers.conf frequently gets truncated to zero length after unclean shutdowns

Michael Sweet msweet at apple.com
Wed Jul 24 11:39:37 UTC 2013


Jiri,

Yes, that would be the alternative, although we need to be careful - delete the last printer and then do a clean shutdown.  If we don't do anything about it, starting up cupsd might load a previous printers.conf file with old printer definitions but without the associates PPDs so you'd have a bunch of "zombie" raw queues...

Assuming that calling fsync will fix the truncated file issue on Linux (at least), let's focus on *that* and see where it takes us.

And just to make sure this problem goes away for good in the future, I've filed the following bug to track changes in cupsd to how we persist printer/class configuration:

    <rdar://problem/14532427> cups.org: CUPS 2.0 - separate configuration from state and persist configuration across crashes

My goal (and I've added corresponding comments to the bug) is to move away from the monolithic printers.conf and classes.conf files to separate configuration and state files.  Not only will this minimize the likelihood of a crash causing complete loss of all print queues, but it will also allow us the luxury of using fsync (and whatever other platform-specific incantation) to ensure that the infrequently-changing configuration bits are carefully persisted.  I haven't made any specific implementation decisions yet (do we use a database engine like SQLite, separate files per queue, file versioning, etc.) but I *do* want to speed up cupsd startup with large numbers of queues and address transient queues for IPP Everywhere/AirPrint.


On 2013-07-24, at 6:11 AM, Jiri Popelka <jpopelka at redhat.com> wrote:

> As I mentioned in the initial mail, I've had a patch
> https://bugzilla.redhat.com/attachment.cgi?id=776945
> which makes cupsdOpenConfFile() read filename.O in case filename is truncated to zero.
> Previously the filename.O was read only if filename had not existed.
> Wouldn't that be an alternative ?
> 
> --
> Jiri
> 
> On 07/23/2013 10:51 PM, Till Kamppeter wrote:
>> As a measure of automatic recovery one could perhaps let the startup
>> script of CUPS check whether printers.conf is zero length and if so,
>> copy printers.conf.O to printers.conf.
> 

_________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair



More information about the Printing-architecture mailing list