[Bug] Partition metadata requests leak lookup permits when namespace policy reads fail
Search before reporting
- [x] I searched in the issues and found nothing similar.
Read release policy
- [x] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
Issue Description
When the broker fails to read namespace policies while handling a partition metadata request, the client receives no response and the request keeps a lookup slot occupied.
If this happens repeatedly, all lookup slots can be used up. Existing requests then wait until they time out, while later lookup and metadata requests may be rejected.
flowchart LR
A[Policy read fails] --> B[No response is sent]
B --> C[Lookup slot is not released]
C --> D[Lookup slots run out]
D --> E[Requests time out or are rejected]
The broker should return an error and release the lookup slot whenever the request finishes, including when reading namespace policies fails.
Reproducing the issue
- Make the namespace policy store temporarily unavailable or otherwise cause a policy read to fail.
- Send a partition metadata request during the failure.
- Repeat the request several times.
The affected requests receive no response, and each failure leaves one lookup slot occupied. Once the slots are exhausted, later lookup requests time out or are rejected.
Additional information
Related fix: #26606
Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Hi @void-ptr974, I'd like to work on this issue. Could you please assign it to me?
My initial approach would be to:
- trace the partition metadata request flow and identify where the namespace policy read failure exits without completing the request,
- verify how the lookup permit is acquired and released in the normal and error paths,
- ensure that policy read failures return an appropriate error response and release the lookup permit,
- add or update tests covering the namespace policy read failure case and verify that repeated failures do not leak lookup permits.
I’ll also review the related fix in #26606 to understand the expected behavior before making the changes.
Thanks!
Hi @aryan9948, thanks for offering to help. This issue is already being addressed by #26606, so a separate implementation would duplicate the work.
If you’d still like to contribute, exploring and validating Pulsar 5.x features would be very helpful, as those areas could use more testing and feedback. Thanks!