You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/04/21 09:21:21 UTC

[GitHub] [kafka] wenbingshen opened a new pull request #10575: KAFKA-12702: Fix NPE in networkListeners from BrokerServer

wenbingshen opened a new pull request #10575:
URL: https://github.com/apache/kafka/pull/10575


   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](https://issues.apache.org/jira/browse/KAFKA-12702)
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] wenbingshen commented on pull request #10575: KAFKA-12702: Fix NPE in networkListeners from BrokerServer

Posted by GitBox <gi...@apache.org>.
wenbingshen commented on pull request #10575:
URL: https://github.com/apache/kafka/pull/10575#issuecomment-824508678


   > @wenbingshen As `Utils.isBlank(ep.host)` does not exist in 2.8, could you file another PR for 2.8 branch?
   
   Of course, I will do it now, thank you for your guidance. :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] chia7712 commented on pull request #10575: KAFKA-12702: Fix NPE in networkListeners from BrokerServer

Posted by GitBox <gi...@apache.org>.
chia7712 commented on pull request #10575:
URL: https://github.com/apache/kafka/pull/10575#issuecomment-824507357


   @wenbingshen As `Utils.isBlank(ep.host)` does not exist in 2.8, could you file another PR for 2.8 branch?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] chia7712 commented on a change in pull request #10575: KAFKA-12702: Fix NPE in networkListeners from BrokerServer

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #10575:
URL: https://github.com/apache/kafka/pull/10575#discussion_r617365981



##########
File path: core/src/main/scala/kafka/server/BrokerServer.scala
##########
@@ -272,7 +273,7 @@ class BrokerServer(
       val networkListeners = new ListenerCollection()
       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).

Review comment:
       Could you use `Utils.isBlank(ep.host)`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] chia7712 merged pull request #10575: KAFKA-12702: Fix NPE in networkListeners from BrokerServer

Posted by GitBox <gi...@apache.org>.
chia7712 merged pull request #10575:
URL: https://github.com/apache/kafka/pull/10575


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] wenbingshen commented on a change in pull request #10575: KAFKA-12702: Fix NPE in networkListeners from BrokerServer

Posted by GitBox <gi...@apache.org>.
wenbingshen commented on a change in pull request #10575:
URL: https://github.com/apache/kafka/pull/10575#discussion_r617379329



##########
File path: core/src/main/scala/kafka/server/BrokerServer.scala
##########
@@ -272,7 +273,7 @@ class BrokerServer(
       val networkListeners = new ListenerCollection()
       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).

Review comment:
       Good idea.Thank you for your guidance and submit your feedback. :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org