Kafka Streams failed to delete the state directory - DirectoryNotEmptyException

柔情痞子 提交于 2019-12-11 06:04:30

问题


I noticed the exception stream-thread [x-CleanupThread] Failed to delete the state directory with our kafka streams application. Application uses a windowed state store and is defined as:

Stores.windowStoreBuilder(
    Stores.persistentWindowStore(
        storeName,
        retentionPeriod,
        retentionWindowSize,
        false),
    Serdes.String(),
    Serdes.String()).withCachingEnabled();  

This is not a test issue using topology driver. This is in actual deployed stream application. Every ten minutes it will try to delete the directory and fail with the stack trace below. Checking the directory it appears empty using ls -al. I have also tried modifying the permissions of the directory using chmod 777 with no luck.

Stack Trace:

 java.nio.file.DirectoryNotEmptyException: /data/consumer/0_17
        at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242)
        at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
        at java.nio.file.Files.delete(Files.java:1126)
        at org.apache.kafka.common.utils.Utils$2.postVisitDirectory(Utils.java:763)
        at org.apache.kafka.common.utils.Utils$2.postVisitDirectory(Utils.java:746)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at org.apache.kafka.common.utils.Utils.delete(Utils.java:746)
        at org.apache.kafka.streams.processor.internals.StateDirectory.cleanRemovedTasks(StateDirectory.java:290)
        at org.apache.kafka.streams.processor.internals.StateDirectory.cleanRemovedTasks(StateDirectory.java:253)
        at org.apache.kafka.streams.KafkaStreams$2.run(KafkaStreams.java:794)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)

来源:https://stackoverflow.com/questions/56282751/kafka-streams-failed-to-delete-the-state-directory-directorynotemptyexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!