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

Kafka broker does not list nodes first ~ 30s after startup



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      Clean Docker environment, very simple everything single node.


      Steps to reproduce:

      1. Start single Zookeeper instance.
      2. Start single Kafka instance.
      3. Validate that the line
        INFO [KafkaServer id=0] started (kafka.server.KafkaServer)

        is printed.

      4. Connect using a Kafka client with debug logging enabled, right after seeing that line, do not wait.
      5. Observe that it is connected to the Kafka broker just fine, but that the broker lists an empty lists of nodes:
        Updating cluster metadata to Cluster(id = xxx, nodes = [], [...]
      6. Keep watching for about 30 seconds, seeing that log entry popping up hundreds of times on the client. Nothing happens in Kafka/Zookeeper logs in the meantime, but then suddenly the Kafka server start reporting nodes to the connected client:
        [...] nodes = [kafka:9092 (id: 0 rack: null)], [...]
        o.apache.kafka.clients.NetworkClient - [AdminClient clientId=adminclient-1] Initiating connection to node [...]

        and it connects all fine.

      My expectation is that it should list itself rightaway after listening on the network as a broker. It should not take ~ 30 seconds for a Kafka client to be blocked waiting and timing out first.

      Use case: I'm trying to create topics in a CI/CD pipeline and spinning up a clean Kafka for that. Right after it's started, it should be possible to create topics using an AdminClient, but currently experiencing TimeoutException: Timed out waiting for a node assignment errors unless I put a sleep 30 between observing a Kafka reportedly ready and starting the topic creation process. Not very ideal.




            • Assignee:
              gertvdijk Gert van Dijk
            • Votes:
              1 Vote for this issue
              5 Start watching this issue


              • Created: