-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PPD file lost after crash #1109
Comments
It sounds like the whole system is crashing (not just the display manager), which is why cupsd goes away. If cupsd was in the process of updating the PPD file (why this would be, I'm not sure, but filters can tell cupsd to update attributes in the PPD file so maybe there was an active print job when things crashed?) then it is possible for the file to be truncated. We could conceivably revert the PPD file using the backup file if we cannot open the current PPD, but we need to be careful. |
I generally think that when editing a critical file it's best to work on a copy and replace it only when done. |
That is how cupsd does things since at least CUPS 1.5 - see scheduler/file.c. New files are created with a ".N" extension, written to, flushed to disk, and then renamed (filename.ppd -> filename.ppd.O, filename.ppd.N -> filename.ppd). There isn't an atomic way to do this but we do try to do it quickly and as safely as possible. I'm not sure what patches your distro is using, and 2.3.3 is several years old, but there isn't anything in the stock cupsd that should leave an empty PPD file on its own. |
@michaelrsweet actually we do not do this in cupsdUpdatePrinterPPD() (IIUC) - we straight rename the current PPD and then open them both (latest master):
so with bad luck, we can hit such result as @arnon-weinberg . @michaelrsweet so let's use cupsdCreateConfFile() and friends there, since PPD in scheduler is in general like config file (it is saved into /etc/cups where is configuration) and it is used by cupsd, so cupsd functions make sense? |
@arnon-weinberg can you provide a reproducer? By coincidence I'm Fedora/Centos Stream maintainer as well, but if you would like me to consider fixing it in Centos Stream (base of Alma AFAIK), I will need a reproducer for verifying/writing a test. |
@zdohnal I can't reproduce a perfectly-timed crash scenario on command. Given how briefly the file is in a vulnerable state, I'm surprised that it happened by chance 4 times over the past 2 weeks - it feels like there ought to be more to the story than just bad luck... Also of note:
|
Several times now, I've had a display manager (GDM) crash (likely nothing to do with cups), that appears to kill cups in the process, and following restart, the PPD file is gone. I am wondering if cups is interrupted at the wrong time whether it's possible that the PPD file could be lost this way?
Here is what the relevant parts of journalctl look like:
That is, it looks like cups was working fine immediately prior to the crash, and immediately after, not. Prior to the crash, /etc/cups/ppd/ looked like:
and immediately after, it looks like:
The 0-byte file timestamp suggests it was overwritten just prior to the crash.
System Information:
The text was updated successfully, but these errors were encountered: