-
Notifications
You must be signed in to change notification settings - Fork 195
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
cupsd sometimes enters a infinite loop when timeout variable gets lower than current_time #604
Comments
I've lowered the priority, since it is not hit every time you run cupsd and there is a workaround. |
TL:DR; Old job files are not cleaned up, keeping the scheduler awake with unsuccessful cleanup attempts. I traced this a bit deeper with gdb and found the following: First,
Note: JobHistoryUpdate is stuck and will never get updated, but more on that later. At the end of the function, the value of
fixing Then in the main scheduler loop, we find another check for
Let's talk about my suspected culprit. cupsdCleanJobs iterates over all jobs and recomputes I've set a breakpoint on
The conjunction with Browsing around in my web UI shows that most of my completed jobs still have printers "associated" with them. At least there is an href pointing to the printer. My oldest job is from 2020 and I did delete a printer since then, and because jobs from those deleted printers don't exist anymore, I assume that only for those jobs, the cleanup logic worked. Conclusion: It feels like dropping |
@clefru The |
What is the workaround? (sorry for asking). |
Without making Has anyone looked into |
Usually restarting the service helps. If it does not, I clean up /var/spool/cups of d and c files. |
Based on currently unknown trigger scheduler sometimes sets JobHistoryUpdate into past, which causes `select()` to timeout after one second. It happens when `job->file_time` of a job without files to remove gets assigned to `JobHistoryUpdate`. If we check for `job->num_files` and assign the `job->file_time` only if there are any, we will fix extensive logging (and unneeded cupsd execution) in various places, e.g. cleaning jobs, expiring subscriptions, deleting temporary queues... Fixes OpenPrinting#604
@clefru thanks for the investigation! I've found time to look into it too (or rather I got annoyed that I saw it again :) ) - I think we have to check I'll create PR for it. |
Based on currently unknown trigger scheduler sometimes sets JobHistoryUpdate into past, which causes select() to timeout after one second. It happens when job->file_time of a job without files to remove gets assigned to JobHistoryUpdate. If we check for job->num_files and assign the job->file_time only if there are any, we will fix extensive logging (and unneeded cupsd execution) in various places, e.g. cleaning jobs, expiring subscriptions, deleting temporary queues... Fixes #604
@zdohnal Thank you for the fix! |
Master commit: 541f72d1cc1 Fixes #604
Describe the bug
cupsd is in infinite loop, causing doing a certain operation (expiring subscriptions/deleting temp printers/removing job files) every second until the service is restarted. The trigger of the issue is unknown, but it happens when a timeout variable (f.e.
expire_time
orlocal_timeout
) is lower thancurrent_time
, causing cupsd to run an operation every second.To Reproduce
Steps to reproduce the behavior:
Unknown
Expected behavior
No infinite loop after a certain event
System Information:
Additional context
The additional data here #578 , however the complete error_log is difficult to provide, since we don't know what triggers the issue and once the issue finally shows itself, a ton of logs are provided and it is difficult to track what triggered it. I'll keep my eyes on this.
The text was updated successfully, but these errors were encountered: