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

NullPointerException when loading logs at startup

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.3.0, 2.2.1
    • Fix Version/s: 2.3.0, 2.1.2, 2.2.2
    • Component/s: log
    • Labels:
      None

      Description

      If brokers restart when topics are being deleted, it's possible to end up with a partition folder with the deleted suffix but without any log segments:

      ls -la ./kafka-logs/3part3rep5-1.f2ce83b86df9416abe50d2e2299009c2-delete/
      total 8
      drwxr-xr-x@  4 mickael  staff   128  6 Jun 14:35 .
      drwxr-xr-x@ 61 mickael  staff  1952  6 Jun 14:35 ..
      rw-rr-@  1 mickael  staff    10  6 Jun 14:32 00000000000023261863.snapshot
      rw-rr-@  1 mickael  staff     0  6 Jun 14:35 leader-epoch-checkpoint

      From 2.2.1, brokers fail to start when loading such folders:

      [2019-06-19 09:40:48,123] ERROR There was an error in one of the threads during logs loading: java.lang.NullPointerException (kafka.log.LogManager)
      [2019-06-19 09:40:48,126] ERROR [KafkaServer id=1] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
      java.lang.NullPointerException
      at kafka.log.Log.activeSegment(Log.scala:1896)
      at kafka.log.Log.<init>(Log.scala:295)
      at kafka.log.Log$.apply(Log.scala:2186)
      at kafka.log.LogManager.loadLog(LogManager.scala:275)
      at kafka.log.LogManager.$anonfun$loadLogs$12(LogManager.scala:345)
      at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:63)
      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:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)

      With 2.2.0, upon loading such folders, brokers create a new empty log segment and load that successfully.

      The change of behaviour was introduced in https://github.com/apache/kafka/commit/f000dab5442ce49c4852823c257b4fb0cdfe15aa

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ecomar Edoardo Comar
                Reporter:
                mimaison Mickael Maison
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: