-
-
Notifications
You must be signed in to change notification settings - Fork 62
Deadlock When Enumerating Printers via Web on macOS #406
Description
Describe the bug
On macOS, the system rw_lock seems to deadlock occasionally if the web interface is iterating over printers. This triggers a read lock, then checks whether each printer is the default by fetching that value from the system and taking a recursive read. If a writer (e.g. _papplClientCreate) is also waiting at this time, the system may deadlock. I believe this works transparently on Linux, but is undefined on macOS.
To Reproduce
Steps to reproduce the behavior:
- Build pappl 1.4.9 and lprint 1.3.1
- Start server with default options
- Add one or more printers
- Navigate to "web home" a few times
Expected behavior
Web interface eventually responds, doesn't deadlock (checked using Activity Monitor and Sample)
Screenshots
No screenshots yet
System Information:
- OS: macOS 13.7.8
- Browser Safari
- Version 1.3.1
Additional context
Simply hoisting the default printer id request out of the loop and setting it temporarily on "client" seems to be enough to avoid the issue.
A rudimentary patch is included below.