I'm facing an issue with Kafka running in KRaft mode (without Zookeeper) on a Windows environment, and I keep getting an AccessDeniedException in the logs when Kafka attempts to delete specific snapshot files.
Here’s the detailed error from the logs:
java.nio.file.AccessDeniedException: C:\tmp\kraft-combined-logs\__cluster_metadata- 0\00000000000000943744-0000000001.checkpoint.deleted at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
Kafka version: Using KRaft mode (without ZooKeeper)
OS: Windows 10
log.retention.bytes=1073741824 (1 GB)
log.segment.bytes=1073741824 (1 GB)
log.retention.hours=24
log.retention.check.interval.ms=300000 (5 minutes)
What I’ve Tried So Far: I tried increasing log.segment.bytes and log.retention.bytes to 2 GB to reduce the frequency of segment rotation and deletion. This didn't resolve the issue, and the AccessDeniedException still occurs during the retention check interval
I manually stopped Kafka, deleted the snapshot files that were causing the error, and restarted Kafka. This temporarily resolves the issue, but it reoccurs after some time when Kafka again tries to delete files automatically I checked using Process Explorer (Windows tool) to see if any other processes were locking the files, but it seems that only Kafka is accessing them.
Kafka Shutdown and Restart: I ensured that Kafka was fully shut down before restarting it to release any file locks, but the issue persists.