You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Niels Hoogeveen (JIRA)" <ji...@apache.org> on 2017/10/10 12:52:00 UTC

[jira] [Created] (KAFKA-6044) Unable to start broker after ungraceful shutdown on windows

Niels Hoogeveen created KAFKA-6044:
--------------------------------------

             Summary: Unable to start broker after ungraceful shutdown on windows
                 Key: KAFKA-6044
                 URL: https://issues.apache.org/jira/browse/KAFKA-6044
             Project: Kafka
          Issue Type: Bug
          Components: core
    Affects Versions: 0.11.0.0
         Environment: Windows
            Reporter: Niels Hoogeveen


When a broker is ungracefully shutdown on windows, it won't restart, and shows the following message:

[2017-10-10 14:41:20,196] INFO Loading logs. (kafka.log.LogManager)
[2017-10-10 14:41:20,244] WARN Found a corrupted index file due to requirement failed: Corrupt index found, index file (
c:\tmp\kafka-logs\test-0\00000000000000000000.index) has non-zero size but the last offset is 0 which is no larger than
the base offset 0.}. deleting c:\tmp\kafka-logs\test-0\00000000000000000000.timeindex, c:\tmp\kafka-logs\test-0\00000000
000000000000.index, and c:\tmp\kafka-logs\test-0\00000000000000000000.txnindex and rebuilding index... (kafka.log.Log)
[2017-10-10 14:41:20,245] ERROR There was an error in one of the threads during logs loading: java.nio.file.FileSystemEx
ception: c:\tmp\kafka-logs\test-0\00000000000000000000.timeindex: The process cannot access the file because it is being
 used by another process.
 (kafka.log.LogManager)
[2017-10-10 14:41:20,246] FATAL [Kafka Server 0], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.ser
ver.KafkaServer)
java.nio.file.FileSystemException: c:\tmp\kafka-logs\test-0\00000000000000000000.timeindex: The process cannot access the file because it is being used by another process.

        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
        at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
        at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
        at java.nio.file.Files.deleteIfExists(Files.java:1165)
        at kafka.log.Log$$anonfun$loadSegmentFiles$3.apply(Log.scala:321)
        at kafka.log.Log$$anonfun$loadSegmentFiles$3.apply(Log.scala:279)
        at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
        at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
        at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
        at kafka.log.Log.loadSegmentFiles(Log.scala:279)
        at kafka.log.Log.loadSegments(Log.scala:386)
        at kafka.log.Log.<init>(Log.scala:186)
        at kafka.log.Log$.apply(Log.scala:1612)
        at kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$5$$anonfun$apply$12$$anonfun$apply$1.apply$mcV$sp(LogManage
r.scala:172)
        at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:57)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

In kafka.log.Log.scala the offending code seems to be:

329              Files.deleteIfExists(timeIndexFile.toPath)
328              Files.delete(indexFile.toPath)

The files are still memory mapped and can therefore not be deleted.

When replacing these two lines with the following, recovery continues and everything seems to be working well:

if(timeIndexFileExists)
     timeIndexFile.delete()
indexFile.delete()

Kind regards,
Niels Hoogeveen




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)