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

Kafka clients fail to start if one of broker isn't resolved by DNS

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • None
    • None
    • None
    • None

    Description

      During org.apache.kafka.clients.producer.KafkaProducer and org.apache.kafka.clients.consumer.KafkaConsumer object creation constructors invoke org.apache.kafka.common.utils.ClientUtils#parseAndValidateAddresses
      which potentially could throw an exception if one the nodes hasn't been resolved by DNS. As a result of that - object hasn't been created and you aren't able to use Kafka clients.

      I personally think that Kafka should be able to operate with cluster with quorum number of instances.

      try {
          InetSocketAddress address = new InetSocketAddress(host, port);
          if (address.isUnresolved())
              throw new ConfigException("DNS resolution failed for url in " + ProducerConfig.BOOTSTRAP_SERVERS_CONFIG + ": " + url);
          addresses.add(address);
      } catch (NumberFormatException e) {
          throw new ConfigException("Invalid port in " + ProducerConfig.BOOTSTRAP_SERVERS_CONFIG + ": " + url);
      }
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            apakulov Alexander Pakulov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment