Deleting topics throws exception
See original GitHub issueIssue Description
When running EmbeddedSingleNodeKafkaCluster#deleteTopicsAndWait, Exception occurs if topics exist, and topics aren’t deleted. Have confirmed this on 2 machines (Windows 8.1 and Windows 10, both using java version 1.8.0_181).
Exception:
Caused by: java.nio.file.AccessDeniedException: C:\Users\gwade\AppData\Local\Temp\junit6747789160683566966\junit5490786451417386230\topic-0 -> C:\Users\gwade\AppData\Local\Temp\junit6747789160683566966\junit5490786451417386230\topic-0.a3c80cfca5e740bd8c1be434d817af2c-delete
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:387)
at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287)
at java.nio.file.Files.move(Files.java:1395)
at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:809)
at kafka.log.Log$$anonfun$renameDir$1.apply$mcV$sp(Log.scala:728)
at kafka.log.Log$$anonfun$renameDir$1.apply(Log.scala:726)
at kafka.log.Log$$anonfun$renameDir$1.apply(Log.scala:726)
at kafka.log.Log.maybeHandleIOException(Log.scala:1927)
at kafka.log.Log.renameDir(Log.scala:726)
at kafka.log.LogManager.asyncDelete(LogManager.scala:842)
at kafka.cluster.Partition$$anonfun$delete$1.apply(Partition.scala:353)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:259)
at kafka.cluster.Partition.delete(Partition.scala:347)
at kafka.server.ReplicaManager.stopReplica(ReplicaManager.scala:350)
at kafka.server.ReplicaManager$$anonfun$stopReplicas$2.apply(ReplicaManager.scala:380)
at kafka.server.ReplicaManager$$anonfun$stopReplicas$2.apply(ReplicaManager.scala:378)
at scala.collection.Iterator$class.foreach(Iterator.scala:893)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at kafka.server.ReplicaManager.stopReplicas(ReplicaManager.scala:378)
at kafka.server.KafkaApis.handleStopReplicaRequest(KafkaApis.scala:200)
at kafka.server.KafkaApis.handle(KafkaApis.scala:111)
at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69)
at java.lang.Thread.run(Thread.java:748)
Suppressed: java.nio.file.AccessDeniedException: C:\Users\gwade\AppData\Local\Temp\junit6747789160683566966\junit5490786451417386230\topic-0 -> C:\Users\gwade\AppData\Local\Temp\junit6747789160683566966\junit5490786451417386230\topic-0.a3c80cfca5e740bd8c1be434d817af2c-delete
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:301)
at sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:287)
at java.nio.file.Files.move(Files.java:1395)
at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:806)
... 22 more
This is recreated by this test https://pastebin.com/Rt0uZjDk
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
AccessDeniedException when deleting a topic on Windows ...
1- stop zookeeper & Kafka server, 2- then go to 'kafka-logs' folder , there you will see list of kafka topic folders, delete...
Read more >[#KAFKA-5975] No response when deleting topics ... - Apache
When trying to delete topics using the KafkaAdminClient and the flag in server ... + public void testDeleteTopics() throws Exception {
Read more >Manually delete Apache Kafka topics | by Sunny Srinidhi
If you don't get an error, it means that topic is not yet deleted. Now run the following two commands to delete the...
Read more >Freeing Objects in Exceptions | Microsoft Learn
As written above, myPerson will not be deleted if an exception is thrown by SomeFunc . Execution jumps directly to the next outer...
Read more >How Do I Solve the Problem that Kafka Topics Cannot ... - 华为云
How do I delete a Kafka topic if it fails to be deleted? ... UnsatisfiedLinkError: Permission denied" exception thrown while starting HBase shell?...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this issue hasn’t gone, wondering why is closed. can we reopen it plz…unlesss it is a duplicate. I am using Kafka 2.3.1 on Windows 10 1803.
Since it’s not cool to continue offering a Windows distribution and later cop out by saying, don’t use the Windows distribution, the following is what worked for me when deleting a topic:
C:\kafka_2.13-2.4.0>.\bin\windows\kafka-topics.bat --zookeeper localhost:2181 --delete --topic mytopic
Since this only marks it for deletion, I then rebooted machine, restarted zookeeper and kafka, and re-ran the app that I had originally used to create the topic with the topic I’m trying to get rid of now removed(don’t remember what order I did the steps in).
This worked for me one time but not others. In that case I had to go to C:\tmp and remove both zookeeper and kafka-logs, then do steps above.