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

Kafka broker fails to start if a topic containing dot in its name is marked for delete but hasn't been deleted during previous uptime

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 0.10.2.0, 0.10.2.1
    • 0.10.2.2, 0.11.0.0
    • core
    • None

    Description

      We are using 0.10.2.0 (but this is reproducible even with 0.10.2.1 and latest upstream) in our environments. Our topic names contain (one or more) dot characters in their name. So we have topics like foo.bar-testtopic. Topic deletion is enabled on the broker(s) and our application does delete the topics as and when necessary.

      We just ran into a case today where for some reason the Kafka broker had either to be taken down (or went down on its own). Some of the topics which were deleted (i.e. a deletion marker folder was created for them) were left around after Kafka broker had gone down. So the Kafka logs dir had directories like foo.bar-testtopic-0.bb7981c216b845648edfe6e2b0a5c050-delete.

      When we restarted the Kafka broker, it refused to start and kept shutting down and running into this exception:

      [2017-05-12 21:36:27,876] ERROR There was an error in one of the threads during logs loading: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 (kafka.log.LogManager)
      [2017-05-12 21:36:27,900] FATAL [Kafka Server 0], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      	at java.lang.String.substring(String.java:1967)
      	at kafka.log.Log$.parseTopicPartitionName(Log.scala:1146)
      	at kafka.log.LogManager.$anonfun$loadLogs$10(LogManager.scala:153)
      	at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:57)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      [2017-05-12 21:36:27,950] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer)
      

      The only way we could get past this is pointing Kafka broker to a different Kafka logs directory which effectively meant a lot our topics were no longer accessible to the application.

      Attachments

        Activity

          People

            jaikiran Jaikiran Pai
            jaikiran Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: