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

Can not delete topics in Windows OS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 2.3.0
    • None
    • core
    • None
    • Windows Server 2016 x64

    Description

      I simply download the kafka_2.12-2.3.0.tgz and follow the instructions to start the zookeeper and kafka server, and then create and delete a test topic:

      D:\test\kafka\kafka_2.12-2.3.0>bin\windows\kafka-topics.bat --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test

      D:\test\kafka\kafka_2.12-2.3.0>bin\windows\kafka-topics.bat --delete --bootstrap-server localhost:9092 --topic test

      The server crashed with exception:

      [2019-08-17 18:44:47,925] INFO [GroupCoordinator 0]: Removed 0 offsets associated with deleted partitions: test-0. (kafka.coordinator.group.GroupCoordinator)
      [2019-08-17 18:44:47,941] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Set(test-0) (kafka.server.ReplicaFetcherManager)
      [2019-08-17 18:44:47,956] INFO [ReplicaAlterLogDirsManager on broker 0] Removed fetcher for partitions Set(test-0) (kafka.server.ReplicaAlterLogDirsManager)
      [2019-08-17 18:44:47,956] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Set(test-0) (kafka.server.ReplicaFetcherManager)
      [2019-08-17 18:44:47,956] INFO [ReplicaAlterLogDirsManager on broker 0] Removed fetcher for partitions Set(test-0) (kafka.server.ReplicaAlterLogDirsManager)
      [2019-08-17 18:44:47,972] ERROR Error while renaming dir for test-0 in log dir D:\tmp\kafka-logs (kafka.server.LogDirFailureChannel)
      java.nio.file.AccessDeniedException: D:\tmp\kafka-logs\test-0 -> D:\tmp\kafka-logs\test-0.abfdf9effeb946f887db070659ae97d6-delete
      at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
      at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
      at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:395)
      at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:288)
      at java.base/java.nio.file.Files.move(Files.java:1421)
      at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:815)
      at kafka.log.Log.$anonfun$renameDir$2(Log.scala:784)
      at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
      at kafka.log.Log.maybeHandleIOException(Log.scala:2065)
      at kafka.log.Log.renameDir(Log.scala:782)
      at kafka.log.LogManager.asyncDelete(LogManager.scala:858)
      at kafka.cluster.Partition.$anonfun$delete$1(Partition.scala:374)
      at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253)
      at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:261)
      at kafka.cluster.Partition.delete(Partition.scala:368)
      at kafka.server.ReplicaManager.stopReplica(ReplicaManager.scala:368)
      at kafka.server.ReplicaManager.$anonfun$stopReplicas$2(ReplicaManager.scala:398)
      at scala.collection.immutable.Set$Set1.foreach(Set.scala:97)
      at kafka.server.ReplicaManager.stopReplicas(ReplicaManager.scala:396)
      at kafka.server.KafkaApis.handleStopReplicaRequest(KafkaApis.scala:219)
      at kafka.server.KafkaApis.handle(KafkaApis.scala:118)
      at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69)
      at java.base/java.lang.Thread.run(Thread.java:834)
      Suppressed: java.nio.file.AccessDeniedException: D:\tmp\kafka-logs\test-0 -> D:\tmp\kafka-logs\test-0.abfdf9effeb946f887db070659ae97d6-delete
      at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
      at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
      at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:309)
      at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:288)
      at java.base/java.nio.file.Files.move(Files.java:1421)
      at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:812)
      ... 17 more
      [2019-08-17 18:44:47,972] INFO [ReplicaManager broker=0] Stopping serving replicas in dir D:\tmp\kafka-logs (kafka.server.ReplicaManager)
      [2019-08-17 18:44:47,972] INFO [ReplicaManager broker=0] Broker 0 stopped fetcher for partitions and stopped moving logs for partitions because they are in the failed log directory D:\tmp\kafka-logs. (kafka.server.ReplicaManager)
      [2019-08-17 18:44:47,972] INFO Stopping serving logs in dir D:\tmp\kafka-logs (kafka.log.LogManager)
      [2019-08-17 18:44:47,988] ERROR Shutdown broker because all log dirs in D:\tmp\kafka-logs have failed (kafka.log.LogManager)
      [2019-08-17 18:44:47,988] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Set(test-0) (kafka.server.ReplicaFetcherManager)
      [2019-08-17 18:44:47,988] INFO [ReplicaAlterLogDirsManager on broker 0] Removed fetcher for partitions Set(test-0) (kafka.server.ReplicaAlterLogDirsManager)

      D:\test\kafka\kafka_2.12-2.3.0>

      I searched on the web, seems this is a bug rooted in the mmap mechanism which is different in Windows and *nix. This bug makes kafka totally unavailable in windows, so hope to be fixed soon.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              goldenbull Chen Jinniu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: