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

Kafka doesn't start with KRaft on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.1
    • 3.6.0
    • kraft
    • None

    Description

      Basic setup doesn't work on Windows 10.

      Steps

      • Initialize cluster with -
          bin\windows\kafka-storage.bat random-uuid
          bin\windows\kafka-storage.bat format -t %cluster_id% -c .\config\kraft\server.properties

       

      • Start Kafka with -
         bin\windows\kafka-server-start.bat .\config\kraft\server.properties

       

      Stacktrace

      Kafka fails to start with following exception -

      D:\LocationGuru\Servers\Kafka-3.3>bin\windows\kafka-server-start.bat .\config\kraft\server.properties
      [2022-10-03 23:14:20,089] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
      [2022-10-03 23:14:20,375] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
      [2022-10-03 23:14:20,594] INFO [LogLoader partition=__cluster_metadata-0, dir=D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs] Loading producer state till offset 0 with message format version 2 (kafka.log.UnifiedLog$)
      [2022-10-03 23:14:20,594] INFO [LogLoader partition=__cluster_metadata-0, dir=D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs] Reloading from producer snapshot and rebuilding producer state from offset 0 (kafka.log.UnifiedLog$)
      [2022-10-03 23:14:20,594] INFO [LogLoader partition=__cluster_metadata-0, dir=D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs] Producer state recovery took 0ms for snapshot load and 0ms for segment recovery from offset 0 (kafka.log.UnifiedLog$)
      [2022-10-03 23:14:20,640] INFO Initialized snapshots with IDs SortedSet() from D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs__cluster_metadata-0 (kafka.raft.KafkaMetadataLog$)
      [2022-10-03 23:14:20,734] INFO [raft-expiration-reaper]: Starting (kafka.raft.TimingWheelExpirationService$ExpiredOperationReaper)
      [2022-10-03 23:14:20,900] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
      java.io.UncheckedIOException: Error while writing the Quorum status from the file D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs__cluster_metadata-0\quorum-state
              at org.apache.kafka.raft.FileBasedStateStore.writeElectionStateToFile(FileBasedStateStore.java:155)
              at org.apache.kafka.raft.FileBasedStateStore.writeElectionState(FileBasedStateStore.java:128)
              at org.apache.kafka.raft.QuorumState.transitionTo(QuorumState.java:477)
              at org.apache.kafka.raft.QuorumState.initialize(QuorumState.java:212)
              at org.apache.kafka.raft.KafkaRaftClient.initialize(KafkaRaftClient.java:369)
              at kafka.raft.KafkaRaftManager.buildRaftClient(RaftManager.scala:200)
              at kafka.raft.KafkaRaftManager.<init>(RaftManager.scala:127)
              at kafka.server.KafkaRaftServer.<init>(KafkaRaftServer.scala:83)
              at kafka.Kafka$.buildServer(Kafka.scala:79)
              at kafka.Kafka$.main(Kafka.scala:87)
              at kafka.Kafka.main(Kafka.scala)
      Caused by: java.nio.file.FileSystemException: D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs_cluster_metadata-0\quorum-state.tmp -> D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs_cluster_metadata-0\quorum-state: The process cannot access the file because it is being used by another process
              at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
              at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
              at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:403)
              at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293)
              at java.base/java.nio.file.Files.move(Files.java:1430)
              at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:935)
              at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:918)
              at org.apache.kafka.raft.FileBasedStateStore.writeElectionStateToFile(FileBasedStateStore.java:152)
              ... 10 more
              Suppressed: java.nio.file.FileSystemException: D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs_cluster_metadata-0\quorum-state.tmp -> D:\LocationGuru\Servers\Kafka-3.3\tmp\kraft-combined-logs_cluster_metadata-0\quorum-state: The process cannot access the file because it is being used by another process
                      at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
                      at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
                      at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:317)
                      at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293)
                      at java.base/java.nio.file.Files.move(Files.java:1430)
                      at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:932)
                      ... 12 more

       

      Environment

      Windows 10 (64 bit)

      Attachments

        Issue Links

          Activity

            People

              jsancio José Armando García Sancio
              kedarjoshi Kedar Joshi
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: