Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-8679

kafka-topics.sh --describe with --zookeeper throws error when there is no topic

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Step to Reproduce:

      First, start a Kafka server (2.2.0+), with no topic on it.

      Then run `kafka-topics.sh --describe --zookeeper ...:2181` to get topic details

      Expected Behavior

      Expected Behavior should be the command prints nothing and return 0.

      Actual Behavior

      The command throws an exception and exit with 1.

      $ kafka_2.12-2.2.1/bin/kafka-topics.sh --describe --zookeeper localhost:2181
      Error while executing topic command : Topics in [] does not exist
      [2019-07-18 06:29:21,336] ERROR java.lang.IllegalArgumentException: Topics in [] does not exist
      	at kafka.admin.TopicCommand$.kafka$admin$TopicCommand$$ensureTopicExists(TopicCommand.scala:416)
      	at kafka.admin.TopicCommand$ZookeeperTopicService.describeTopic(TopicCommand.scala:332)
      	at kafka.admin.TopicCommand$.main(TopicCommand.scala:66)
      	at kafka.admin.TopicCommand.main(TopicCommand.scala)
       (kafka.admin.TopicCommand$)
      

      Others

      IIRC, the version before 2.2.0 did not throw exceptions.
      Also, -describing with -bootstrap-server will exit 0 and print nothing.
      Also -list with either bootstrap-server and -zookeeper will also exit 0 and prints nothing.

      I did some quick search and seems this issue is introduced by https://issues.apache.org/jira/browse/KAFKA-7054. I didn't check which exact line caused the exception. Hope that will help.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                weichu Weichu Liu
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: