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

consumer-subscription not working, when accessing a newly created topic immediately after its creation with the AdminUtils

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.10.0.0, 0.10.0.1
    • None
    • admin, consumer
    • None

    Description

      I created a test-project to reproduce the bug.
      https://github.com/FloWi/kafka-topic-creation-bug

      We use a docker container that creates a fresh topic before a testsuite gets executed (see trait FreshKafkaTopics). That trait uses the AdminUtils to create the topic.

      If we access the newly created topic directly after its creation, the subscriber is broken. It sometimes works though (<5%), so it seems to be a race-condition.

      If I put a Thread.sleep(1000) after the topic-creation, everything's fine though.

      So, the problem is twofold:

      • AdminUtils.createTopic should block until the topic-creation is completed
      • new KafkaConsumer[String, String](props).subscribe(util.Arrays.asList(topic)) should throw an exception, when the topic is "not ready"

      Attachments

        Activity

          People

            Unassigned Unassigned
            apache@flwi.de Florian Witteler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: