KAFKA-12702: Fix NPE in networkListeners from BrokerServer#10575
Merged
chia7712 merged 3 commits intoapache:trunkfrom Apr 22, 2021
Merged
KAFKA-12702: Fix NPE in networkListeners from BrokerServer#10575chia7712 merged 3 commits intoapache:trunkfrom
chia7712 merged 3 commits intoapache:trunkfrom
Conversation
chia7712
reviewed
Apr 21, 2021
Member
chia7712
left a comment
There was a problem hiding this comment.
@wenbingshen nice find! one comment below.
| config.advertisedListeners.foreach { ep => | ||
| networkListeners.add(new Listener(). | ||
| setHost(ep.host). | ||
| setHost(if (ep.host == null || ep.host.trim.isEmpty) InetAddress.getLocalHost.getCanonicalHostName else ep.host). |
Member
There was a problem hiding this comment.
Could you use Utils.isBlank(ep.host)?
Member
Author
There was a problem hiding this comment.
Good idea.Thank you for your guidance and submit your feedback. :)
3 tasks
Member
|
@wenbingshen As |
Member
Author
Of course, I will do it now, thank you for your guidance. :) |
3 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to the comments in the configuration file (config/kraft/server.properties), if listeners and advertised.listeners are not configured with an address, the program will automatically obtain java.net.InetAddress.getCanonicalHostName(), but this will actually cause the service to fail to start. Because the host parameter value of Listener in BrokerRegistrationRequestData will be null.
For more information stack, can link to this jiraId to view: KAFKA-12702
Committer Checklist (excluded from commit message)