Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.9.0.0
-
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.