This message was deleted.
# general
s
This message was deleted.
l
Please report this in https://github.com/apache/pulsar/issues (search first if there's already a match). It might be related to the advertised listeners/address as you suggest.
What is the frequency of the "The current leader broker LeaderBroker(serviceUrl=http://xx.yy.zz.xy:8080) isn't active. Handling load manager decisions in a decentralized way." log messages? Does that happen all the time or occasionally?
m
it is intermittent and very much random.... we noticed that sometimes frequency is 20 times in a min and sometimes 10 times in an hour..
l
@Manmeet this is most likely a bug. Please report an issue to https://github.com/apache/pulsar/issues.
m
sure
👍 1
l
I'll work on confirming a possible issue and a fix.
@Manmeet There's a bug. Regarding "not setting a internalListenerName", The broker will always pick an internal listener. "The broker uses the listener name of the first advertised listener as the internalListenerName if the internalListenerName is absent." (docs) . There seems to be a bug in the way how the leader broker's load manager identifier (host:port) is resolved compared to how other brokers identifiers are resolved. The leader broker's identifier uses the internal listener's host name and in all other cases the advertisedAddress is used. I think that there's a workaround for this. Here's an example
Copy code
advertisedAddress=prod-xx-pulsar-broker-0
advertisedListeners=public_pulsar:<pulsar://xx.yy.zz.xy:6650>,public_http:<http://xx.yy.zz.xy:8080>,internal:<pulsar://prod-xx-pulsar-broker-0:6650>,internal:<http://prod-xx-pulsar-broker-0:8080>
internalListenerName=internal
I'm working on a fix to the problem. Please report the issue to https://github.com/apache/pulsar/issues in the mean time and test the workaround. That would be helpful. Thanks!
fix: https://github.com/apache/pulsar/pull/21894 . This also makes the broker identifiers in the load balancer code consistent in the code base. Fixing the bug is a positive side effect. 🙂
g
Thank you for the update, issue report and the PR. Your speed is unmatched 🙂. While we are also testing this behavior with the workaround -> but we use the isolation group feature where our ns isolation group policy regex is based on broker hostname. just want to validate that there is no impact on that?
m
@Lari Hotari Thank you for your quick response. Reported the issue -https://github.com/apache/pulsar/issues/21897 so that fix PR can be attached to it. Furthermore, could you please assist with the query posed by Girish?
thankyou 1
l
but we use the isolation group feature where our ns isolation group policy regex is based on broker hostname. just want to validate that there is no impact on that?
@Girish Sharma Based on looking at the code, it doesn't look like isolation group feature is impacted.
Thanks for reporting the issue @Manmeet. I hope you find a suitable workaround. I didn't test the workaround that I suggested so it's possible that it needs some adjusting.
thankyou 1
g
So, we tried a bunch of things and it is messy.. I haven't looked into what all the PR is changing in the master, but from the way the code works, i doubt this situation is improved. consider this case:
Copy code
advertisedAddress: <pod-name>.<service-name>
advertisedListeners: XYZ:pulsar://<ip>:6650, XYZ:http://<ip>:80, internal:http://<pod-name>.<service-name>:80
internalListenerName=internal
as soon as we use an
http
protocol internal listener in the advertised listeners, that one gets being used as the "web url" everywhere in pulsar, and not just for internal load balancing.. i.e., in a lookup call when it has to return back with redirect, it would use that
http://<pod-name>.<service-name>:80
as the prefix in the redirect url. This basically makes the
XYZ
lisntner's http protocol IP based address useless.. This leads to failing lookup calls as clients are not able to resolve the redirect url as those k8s based addresses only resolve inside a cluster.
the fix is that the clients (where possible) add a client configuration of
listenerName: XYZ
during client creation.. but that might not be a feasible thing in every tech stack/connector..
@Lari Hotari - by any chance, your PR fixes this situation? Why is an "internal" address being given out to clients..
l
> I haven't looked into what all the PR is changing in the master, but from the way the code works, @Girish Sharma The bug itself is fixed. The PR contained a test case the reproduced the issue. The test case is https://github.com/apache/pulsar/blob/master/pulsar-broker/src/test/java/org/apach[…]adbalance/AdvertisedListenersMultiBrokerLeaderElectionTest.java > as soon as we use an
http
protocol internal listener in the advertised listeners, that one gets being used as the "web url" everywhere in pulsar, and not just for internal load balancing.. i.e., in a lookup call when it has to return back with redirect, it would use that
http://<pod-name>.<service-name>:80
as the prefix in the redirect url. > > This basically makes the
XYZ
lisntner's http protocol IP based address useless.. > This leads to failing lookup calls as clients are not able to resolve the redirect url as those k8s based addresses only resolve inside a cluster. It's a valid observation. There is definitely room for improvements as you are pointing out. > the fix is that the clients (where possible) add a client configuration of
listenerName: XYZ
during client creation.. but that might not be a feasible thing in every tech stack/connector.. yes, this is a good point. > by any chance, your PR fixes this situation? The PR doesn't improve the advertised listener feature. It fixes the load manager's leader broker issue #21897. > Why is an "internal" address being given out to clients.. I'm not sure why it has exactly been implemented this way. It is PIP-61 https://github.com/apache/pulsar/wiki/PIP-61%3A-Advertised-multiple-addresses . Checking the document , PRs and mailing list discussions and reference documentation might reveal more of the context. PIP-61 does mention "only return the corresponding service URL". Perhaps the implementation contains some TODOs. 🙂
g
Checking the document , PRs and mailing list discussions and reference
documentation might reveal more of the context. PIP-61 does mention
"only return the corresponding service URL". Perhaps the implementation
contains some TODOs. 🙂
I was thinking about it. I can't see a "fix" in the current approach. But I definitely think it shouldn't be the default behavior to send in the internal address back in the lookup call in case the client is missing the listener name.. but the only way to do that now is to introduce a broker property called
lookupListener
which defines the name of the listener to be used for lookup if listenerName is missing from lookup call.
l
> but the only way to do that now is to introduce a broker property called
lookupListener
which defines the name of the listener to be used for lookup if listenerName is missing from lookup call. +1. It also comes to mind that there could be a need to support multiple "listener" instances that bind to different server socket port ports so that a listener on a specific port could have a specific default listener. Obviously this would be a lot of additional complexity. I personally fear the way how things are configured. The configuration framework in Pulsar isn't great for hierarchical information which would be better off in yaml files or such. (sidenote: Migrating to https://github.com/gestalt-config/gestalt is something that I have been dreaming about. 🙂 Gestalt Config is very similar to Spring Boot's configuration solution without the coupling to Spring Framework and Spring Boot.)
g
multiple "listener" instances that bind to different server socket port ports so that a listener on a specific port could have a specific default listener.
A per port thing might not cater to all use cases as there is an internal vs external address notation on the same port ..
l
A per port thing might not cater to all use cases as there is an internal vs external address notation on the same port ..
The reason why I mentioned it is that I think that the per port solution would be necessary for implementing what PIP-61 mentions about "only return the corresponding service URL". It's not exclusive for the the default
lookupListener
solution what you proposed. Without a separate listener instance on a different port, it would be hard to distinguish between internal and external traffic. This is just my gut feeling.
g
I was checking the touch points for LookupOptions builder and it does seem like it is used at external places only..
so the logic can be offloaded to LookupOptions' Builder to use a default listener name
l
perhaps. To me it seems that cluster internal access isn't split from others.
g
Could you elaborate a bit more?
l
@Girish Sharma Within the Pulsar cluster, the Pulsar admin REST API is used for many operations broker-to-broker. The redirects are also used in that case. The Pulsar cluster does also use Pulsar binary protocol for broker-to-broker connections for system topics which are for example used for topic policies. Adding the internal listener selection code could be added to that, but somehow the connections would have to indicate the selection of the internal listener. It would be possible to modify all broker-to-broker connections to pass the internal listener name, but I guess that implies that the broker returns it to the client. I haven't checked the details, but this is what I had in mind.
g
the admin APIs also use the 307 approach, i.e. the redirect url goes back to the client. so returning an external name is a good thing there as well. I will have to check the BinaryProtoLookupService.java class as well to see if changes are needed there as well.
The problem is even bigger actually. Just bouncing off here - when a
listenerName
(query param or header) is present in the incoming lookup call, whether it resuts in 200 or 307 redirect, there is one inconsistency today, here or at many places where LookupResult is created inside the
if (options.hasAdvertisedListener())
block. The inconsistency is that while the
pulsar:
and
pulsar+ssl:
protocols urls in the response are chosen from the listernerName of the lookup request, the http and https protocols urls are still returned from the internal listener (or the first from the advertised listener if internal is not present/doesnt have the http scheme) ... This should be consistent, right? all 4 protocol urls should be defined based on the lookup listener name.
PIP-91 seems to completely skip this aspect, which might be because PIP-91 only allowed for pulsar and pulsar+ssl protocols in advertisedListeners.. PIP-95 added the support for http and https protocols but seemed to skip addressing this aspect of the problem.
now if we make this consistent, there may be backward incompatible result for users who are used to this inconsistency.. any thoughts here?
from PIP-95 -
A secondary goal is to improve the interoperability of KOP by implementing smart endpoint selection for ordinary Kafka clients. This shall be based on the semantics of KIP-103 and is consistent with this proposal. Similarly for other protocol handlers.
but KIP-103 clearly also brings in a
CLIENT
listener which serves as all addresses needed for external communication...
l
Good observations @Girish Sharma.
now if we make this consistent, there may be backward incompatible result for users who are used to this inconsistency.. any thoughts here?
It might require creating a PIP to cover the changes although it seems that it would be a bug fix. The benefit of a PIP is that it also serves as a design document for the changes. Would you like to start a drafting a PIP for this where the problem is described and then proposing possible solutions?
g
we are in process of the pip creation. almost finalized.
👌 1
m
@Lari Hotari can you please help with the review?
l
@Manmeet Yes, I'll take a look.
thankyou 1
looking at it now.
btw. I also came across https://github.com/apache/pulsar/pull/17063 which seems to contain some useful changes.
g
IMO, even this change is also not right, at one point it talks about internal vs external IP, but for redirects, sends back the internal non resolvable ip back to clients
l
yes I agree. However it seems to include some useful changes.
It's not a conclusion, more like thinking out aloud.