You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug][client] Multi-topic consumer send flow permits to broker before subscribing completes, leading to possible cascading failures #25005
I searched in the issues and found nothing similar.
Read release policy
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.
Before the #14566 change, the client would first subscribe to all topics and then send flow permits to the broker in the startReceivingMessages method.
The behavioral change after #14566 is that messages will start flowing from the broker to the client immediately. If subscribing to any of the partitions fails, it will add a lot of extra work to the system and could cause cascading failures when brokers are at their limits. It's better to fix this problem and remove the newConsumer.resume(); lines added in this PR.
changed the title [-][Bug][client] Multi-topic consumer send flow permits to broker before subscribing completes leading to possible cascading failures[/-][+][Bug][client] Multi-topic consumer send flow permits to broker before subscribing completes, leading to possible cascading failures[/+]on Nov 21, 2025
In scenarios where a lot of clients loose connectivity at once, the change made in #14566 will amplify the load on the brokers suddenly and a low amount of clients would be able to successfully connect to brokers before the subscribing times out. The clients would then retry and this loop adds a lot of unnecessary load.
However, there's another potential race condition here here. If the connection breaks when the call is made and reconnects immediately, it's possible that the consumer is left in a state where it won't have permits. I think I've seen a few cases like that over the years.
Activity
[-][Bug][client] Multi-topic consumer send flow permits to broker before subscribing completes leading to possible cascading failures[/-][+][Bug][client] Multi-topic consumer send flow permits to broker before subscribing completes, leading to possible cascading failures[/+]lhotari commentedon Nov 21, 2025
In scenarios where a lot of clients loose connectivity at once, the change made in #14566 will amplify the load on the brokers suddenly and a low amount of clients would be able to successfully connect to brokers before the subscribing times out. The clients would then retry and this loop adds a lot of unnecessary load.
lhotari commentedon Nov 21, 2025
The
newConsumer.resume()calls won't impact the behavior in all cases. This logic makes it not effective:pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Lines 951 to 955 in 807dcaf
The permits will be sent here:
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
Lines 236 to 249 in 807dcaf
However, there's another potential race condition here here. If the connection breaks when the call is made and reconnects immediately, it's possible that the consumer is left in a state where it won't have permits. I think I've seen a few cases like that over the years.
lhotari commentedon Nov 21, 2025
Closing as not a bug.