Skip to content

Deadlock When Enumerating Printers via Web on macOS #406

@sjoubani

Description

@sjoubani

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:

  1. Build pappl 1.4.9 and lprint 1.3.1
  2. Start server with default options
  3. Add one or more printers
  4. 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.

pappl-deadlock.patch

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions