I'm currently using Pulsar@3.0.11 and noticed that...
# dev
z
I'm currently using Pulsar@3.0.11 and noticed that the number of
__change_events
subscriptions exceeds the broker nodes * 400, which seems incorrect. Is there already a PR that fixes this issue?
__change_events
is partitioned topic, and has one partitions.
l
Let me check. This rings a bell. I faced something in this direction while working on https://github.com/apache/pulsar/pull/24427
please review https://github.com/apache/pulsar/pull/24427 so that we get the fix made
z
Thanks for the improvements. I noticed that in SystemTopicBasedTopicPoliciesService.java#L388, we only create a reader. Is that correct?
I will review your PR when I'm free.
l
Yes, it's only about readers. Readers do create non durable subscriptions. Do you have more details about the subscriptions?
z
There are no more details. I only see multiple subscriptions:
Copy code
multiTopicsReader-4d69ff4532
2025-08-15T14:41:56,595+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-4d69ff4532. consumerId: 10952
2025-08-15T14:43:18,444+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-4d69ff4532. consumerId: 10952
multiTopicsReader-ae3e48e2c8
2025-08-15T14:41:56,595+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-ae3e48e2c8. consumerId: 144724
2025-08-15T14:43:18,674+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-ae3e48e2c8. consumerId: 144724
multiTopicsReader-b08fafc042
2025-08-15T14:41:56,595+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-b08fafc042. consumerId: 68334
2025-08-15T14:43:18,102+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-b08fafc042. consumerId: 68334
multiTopicsReader-d7f9afa20e
2025-08-15T14:41:56,595+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-d7f9afa20e. consumerId: 78384
2025-08-15T14:43:18,436+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-d7f9afa20e. consumerId: 78384
multiTopicsReader-42a41ecf75
2025-08-15T14:41:56,596+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-42a41ecf75. consumerId: 61971
multiTopicsReader-4ef36ec195
2025-08-15T14:41:56,596+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-4ef36ec195. consumerId: 191712
multiTopicsReader-97afb31b1c
2025-08-15T14:41:56,596+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-97afb31b1c. consumerId: 129471
2025-08-15T14:43:18,784+0800 [pulsar-io-4-42] INFO  org.apache.pulsar.broker.service.ServerCnx - [[id: 0x5fe925d5, L:/10.184.74.77:6650 - R:/10.184.74.5:53732] [SR:10.184.74.5, state:Connected]] Subscribing on topic persistent://public/10000/__change_events-partition-0 / multiTopicsReader-97afb31b1c. consumerId: 129471
It's important to note that each broker should maintain only a active reader on
_change_events
. At the moment, however, the number of readers created has exceeded the number of broker nodes, which indicates unexpected behavior.
l
It seems that there are multiple chances for race conditions in SystemTopicBasedTopicPoliciesService, especially in the error handling paths.
✅ 1
z
I will improve the reader handling when an error occurs.
@Lari Hotari Do you have a chance to review the following pr? https://github.com/apache/pulsar/pull/24638 https://github.com/apache/pulsar/pull/24643