BrowsePoll retains notification sequence across subscription replacement; new queues appear only after expiry/full refresh

Open
#82 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c

Research direction

Read the subscription creation and lease-expiry paths in cups-browsed, using the source excerpts in source-review.txt as a starting point; then trace how later notification requests use context->sequence_number + 1. Reproduce with the attached configuration and logs, letting a subscription expire before adding a shared dummy queue. Done when a replacement subscription tracks notifications from its own sequence position and the new queue is discovered without waiting for another full refresh.

Written by the indexing model from the issue text.

Description

Describe the bug
New shared queues on a remote CUPS server are not promptly discovered by cups-browsed despite regular BrowsePoll requests. Discovery recovers when the remote subscription expires, cups-browsed creates a replacement subscription, and it requests the full printer list.

Architecture: remote CUPS server → local CUPS server. The problem was initially observed on a remote server in our deployed environment and then in a separate container test using a 180-second default lease and 10-second polling interval.

The test uses shared dummy raw queues; no physical printer or print job is needed. This concerns queue discovery, so application names, sample documents, spool files and physical printer models are not applicable to the reproduction. The dummy upstream raw queues have no PPD.

Observed behaviour — 9 November 2026

Time - Observation

14:43:45 - Subscription 399 created; full printer-list request follows.
14:45:33 - Remote queue cb_after3 successfully added; authenticated request returns HTTP 200 / IPP successful-ok.
14:46:19 - Local lpstat -p still does not list cb_after3.
14:46:35 - Remote notification poll reports no events.
14:46:45 - Subscription 399 expires; subscription 401 created; full printer-list request follows.
14:46:46 - cb_after3 discovered, approximately 73 seconds after remote creation.
14:46:56 onward - Captured requests for replacement subscription 401 ask for sequence 1015, also seen for earlier subscription 352.

The key expiry/discovery sequence is:

14:46:45 [BrowsePoll REMOTE-IP:631]: Lease expired
14:46:45 [BrowsePoll REMOTE-IP:631]: IPP-Create-Subscription
14:46:45 [BrowsePoll REMOTE-IP:631]: subscription ID=401
14:46:45 [BrowsePoll REMOTE-IP:631]: CUPS-Get-Printers
14:46:46 Found CUPS queue/class: cb_after3 on host REMOTE-IP.

Prefixes are shortened here; the attached logs preserve the available original context. The first captured request for the replacement subscription includes:

2026-11-09T14:46:56.645674+00:00 cupsdProcessIPPRequest: notify-subscription-ids integer '401'
2026-11-09T14:46:56.645695+00:00 cupsdProcessIPPRequest: notify-sequence-numbers integer '1015'

This request is approximately 11 seconds after subscription creation. “First captured” refers to the supplied excerpts; they do not prove that no earlier request occurred. Further requests at 14:47:06 and 14:48:16 also request 1015.

The supplied excerpts do not show the requested sequence for subscription 399 or enumerate the events available on subscription 401. Delayed discovery occurred under 399; the requests for 401 show that the high requested sequence persisted after the refresh that recovered discovery. We therefore distinguish the observed behaviour from the suspected cause.

To Reproduce

  1. Use a separate test CUPS server and cups-browsed client. Configure the client with BrowsePoll REMOTE-SERVER:631, BrowseInterval 10, and debug logging. Set DefaultLeaseDuration 180 and LogLevel debug2 on the upstream test server before starting the client.
  2. Create and share a dummy seed queue. Generate printer-state changes and let cups-browsed consume notifications, confirming that its requested sequence advances.
  3. Let the remote subscription expire and be replaced without restarting cups-browsed. Wait for the accompanying full printer-list refresh to finish.
  4. Add and share another dummy queue, then observe notification requests and local queue availability.
  5. Check whether discovery occurs only at the next expiry/full refresh, and capture the requested sequence for the replacement subscription.

Exact commands and the lab's configuration template are attached in reproduction.txt, client-config-template.txt and upstream-test-settings.txt. These describe the test setup.

Expected behavior

New shared queues should be discovered through the normal notification/polling cycle without waiting for subscription expiry. Notification tracking should be initialised for a new subscription rather than retaining the previous subscription's sequence position.

System information

  • Reported environment: Ubuntu 24.04; cups and cups-daemon 2.4.7-1.2ubuntu7.14; cups-browsed 2.0.0-0ubuntu10.3.
  • Separate test client: Ubuntu 24.04 container; cups-browsed pinned to 2.0.0-0ubuntu10.3; CUPS dependencies installed from Ubuntu repositories.
  • Exact upstream and test-container package inventories have not yet been captured separately. The reported versions above should not be assumed to apply to both hosts.
  • Distribution binaries, not a custom cups-browsed build; custom ./configure options are not applicable to this test.

Latest upstream source check

Source inspection on 9 November 2026 found the missing sequence reset in both the latest release 2.1.1 (089450357e61673fa9871b927c4b3b6cea4690a1) and master (8f9b98b5f7a7f2ae073ef03d90a53b1c2c8a4a46). Successful subscription creation assigns the new ID without resetting the sequence; the expiry branch calls it and requests a full refresh. Later requests use context->sequence_number + 1.

There is a reset to zero in the separate generic-error branch, but not in the lease-expiry branch. See source-review.txt for exact source excerpts and permanent links.

Attachments and evidence limits

upstream-test-settings.txt
annotated-findings.txt
client-config-template.txt
creation-success-confirmation.txt
latest-logs.txt
reproduction.txt
source-review.txt

  • latest-logs.txt: latest user-supplied batch, with host/model identifiers anonymised; contains selected excerpts and gaps, not continuous logs.
  • creation-success-confirmation.txt: later successful HTTP 200 confirmation, supplied separately from that batch; prefix omitted explicitly.
  • annotated-findings.txt: detailed explanations alongside selected excerpts.
  • source-review.txt: verified release/master code paths.
  • reproduction.txt, client-config-template.txt, upstream-test-settings.txt: reproduction instructions and template configuration.

Timestamps, subscription IDs, sequence numbers and test queue names have been retained to allow correlation.

Dominant language
C
Stars
51
Forks
21
Avg merge
22h 49m
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenPrinting/cups-browsed

All issues in OpenPrinting/cups-browsed

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.