Does Pulsar 4.0.12 or 4.0.13 fully address this namespace topic-policy cache failure after bundle shedding? #26430
Replies: 2 comments 1 reply
|
It's not possible to say that all possible issues are fixed. The most likely ones are fixed in 4.0.13/4.2.4 (same fixes in both). I'd recommend upgrading to 4.0.13 in your case. |
1 reply
|
Thanks, will upgrade and report back if we face something similar. Will try to capture a heap dump as well. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We are looking for confirmation that an incident on Apache Pulsar 4.0.10 matches issue #25294 and that upgrading to 4.0.12 or 4.0.13 is the correct fix.
Our evidence points to a stuck or aborted topic-policy cache initialization for one namespace. An automatic bundle move triggered the incident. One partition remained unavailable for several hours and recovered only after we unloaded the namespace.
The production logs released during that recovery match the
__change_eventsreader andpolicyCacheInitMapfailure described in #25294. The main uncertainty is that we did not capture a heap dump before recovery, so we cannot prove which specific reader race caused the shared future to remain pending.Environment
org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImplorg.apache.pulsar.broker.loadbalance.impl.AvgShedderorg.apache.pulsar.broker.loadbalance.impl.AvgShedderbookkeeper-firstRelevant runtime configuration:
The custom container image uses the upstream
apachepulsar/pulsar-all:4.0.10image and adds authentication, authorization and logging libraries. It does not modify Pulsar broker code.Incident timeline
Times below are UTC.
05:33:41
AvgSheddermoved a bundle from broker-2 to broker-1:The load-balancer log immediately before the move showed:
The high score difference exceeded our configured threshold of 40 for the required two observations.
The affected topic was partitioned. Partitions 0 and 1 remained available. Partition 2 belonged to the moved bundle.
The source broker logged the topic unload and disconnected its producers:
The destination broker then acquired the bundle and started its eager preload:
The bundle currently contains 131 persistent topics.
05:33 onward
The destination broker repeatedly failed to load partition 2:
Producer creation failed with:
Consumer creation for this and other topics in the same namespace also failed with the same topic-load timeout.
The failures repeated every minute. Broker health checks continued to pass, and unrelated topics on the same broker remained available.
A direct admin request reproduced the failure:
Independent partition checks returned:
Topic lookup consistently assigned partition 2 to broker-1.
05:35:48
AvgSheddermoved a second bundle from the same namespace:This happened about two minutes after the first bundle move.
The namespace's
__change_eventstopic is currently in bundle0x00000000_0x40000000. We do not have enough retained logs to prove whether that system-topic bundle also changed ownership during the original incident.Several hours later
We unloaded the full namespace through the admin API. The command completed successfully.
During cleanup, the brokers released many pending topic loads. The first useful root-cause logs appeared at this point:
The same policy-cache exception was then propagated into the affected partition and many other waiting topic loads:
The exception came from
ConsumerBase.failPendingReceiveswhile the namespace unload closed the system-topic reader.After reassignment, all three partitions responded immediately:
Post-recovery diagnostics
We captured a thread dump, class histogram and heap dump after the namespace unload. We understand that this is too late to prove the original pending operation, but we inspected it to confirm the recovered state.
The thread dump showed:
BLOCKEDthreadsSystemTopicBasedTopicPoliciesServiceorTopicPolicyReaderEclipse Memory Analyzer showed:
TopicPolicyReaderinstancesSystemTopicBasedTopicPoliciesService.policyCacheInitMapReadystate__change_eventstopicThe original reader named in the cleanup exception was no longer present, which is expected because the namespace unload closed it and installed a replacement before the dump was taken.
The MAT leak report did not identify policy readers or policy-cache futures as leak suspects. Its main retained groups were normal managed-ledger metadata and producer schema caches.
Our source-code interpretation
In Pulsar 4.0.10,
BrokerService.getTopicwaits for topic-policy initialization before it creates or returns a persistent topic:SystemTopicBasedTopicPoliciesService.prepareInitPoliciesCacheAsynccreates one shared future per namespace:initPolicesCacherecursively callshasMoreEventsAsyncandreadNextAsyncuntil the reader reaches the end of__change_events. There is no timeout around this loop in 4.0.10.The individual topic load has a 60-second timeout:
However, this timeout completes only the topic future. It does not cancel the policy reader or clear the shared
policyCacheInitMapentry. This appears to explain why each retry failed while the underlying namespace state remained stuck.Bundle acquisition also calls
PulsarService.loadNamespaceTopics, which submits a load for every persistent topic in the bundle. In our case this may have submitted around 131 concurrent topic loads on a broker with one CPU andmaxConcurrentTopicLoadRequest=5000. We see this as an amplifier rather than the correctness bug.Related upstream fixes
The incident appears closely related to:
The first three fixes are in Pulsar 4.0.12. The last fix is in Pulsar 4.0.13.
Our production cleanup exception is very similar to the evidence in #25294, including the pending topic-policy operations being released when the reader closes.
Questions
__change_eventsmoved in the retained logs?maxConcurrentTopicLoadRequest=5000too high for a one-CPU broker with geo-replication and tiered storage? Would a value around 250-500 be a reasonable starting point?policyCacheInitMap, the__change_eventsreader position and compacted-reader state on a live broker?Any confirmation or correction of our interpretation would be appreciated.
We plan to upgrade to 4.0.13, but confirmation that our diagnosis is correct would be helpful. We would also appreciate advice on whether to lower topic-load concurrency or increase broker CPU. Our brokers usually run at only 5-15% CPU, but we are happy to increase their capacity if more headroom is needed during bundle loading and recovery.
All reactions