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

Unit tests which dont close producers auto-create topics in Kafka brokers of other tests when port is reused

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0.0
    • Fix Version/s: 0.10.0.0
    • Component/s: unit tests
    • Labels:
      None

      Description

      Consumer tests occasionally fail the exception:

      kafka.common.TopicExistsException: Topic "topic" already exists.
      at kafka.admin.AdminUtils$.createOrUpdateTopicPartitionAssignmentPathInZK(AdminUtils.scala:261)
      at kafka.admin.AdminUtils$.createTopic(AdminUtils.scala:245)
      at kafka.utils.TestUtils$.createTopic(TestUtils.scala:237)
      at kafka.api.BaseConsumerTest.setUp(BaseConsumerTest.scala:65)

      Recreated this failure with some additional logging and it turns out that the failure is because a few tests which create a topic named "topic" close their Kafka server, but not the producer. When the ephemeral port used by the closed Kafka server gets reused in another Kafka server in a subsequent test, the producer retries of the previous test cause "topic" to be recreated using auto-create in the new Kafka server of the subsequent test. This results in an error in the consumer tests occasionally when the topic is auto-created before the test attempts to create it.

        Attachments

          Activity

            People

            • Assignee:
              rsivaram Rajini Sivaram
              Reporter:
              rsivaram Rajini Sivaram
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: