IllegalArgumentException: requirement failed: Corrupt index found

Posted Federico

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IllegalArgumentException: requirement failed: Corrupt index found相关的知识,希望对你有一定的参考价值。

今天突然接到客户反映线上服务器发送消息异常,登录服务器查看是kafka服务出现了问题,想重启一下服务,结果重启出现一下报错

[2017-06-30 19:29:13,708] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
java.lang.IllegalArgumentException: requirement failed: Corrupt index found, index file (/data/apps/log/kafka/metrics-topic-13/00000000000000000000.index) has non-zero size but the last offset is 0 and the base offset is 0
    at scala.Predef$.require(Predef.scala:219)
    at kafka.log.OffsetIndex.sanityCheck(OffsetIndex.scala:352)
    at kafka.log.Log$$anonfun$loadSegments$5.apply(Log.scala:184)
    at kafka.log.Log$$anonfun$loadSegments$5.apply(Log.scala:183)
    at scala.collection.Iterator$class.foreach(Iterator.scala:750)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
    at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
    at kafka.log.Log.loadSegments(Log.scala:183)
    at kafka.log.Log.<init>(Log.scala:67)
    at kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$3$$anonfun$apply$7$$anonfun$apply$1.apply$mcV$sp(LogManager.scala:142)
    at kafka.utils.Utils$$anon$1.run(Utils.scala:54)
    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:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[2017-06-30 19:29:13,711] INFO [Kafka Server 2], shutting down (kafka.server.KafkaServer) 
 
解决方法如下:
find kafka-logs/  -size 10485760c -name *.index
将以上命令中搜索到的所有文件删除,在重启kafka,kafka会重新生成相应的文件,询问研发人员说删除的数据不会对线上服务造成影响,但是如果你也碰到了这种问题最好还是要先问问你们部门的研发人员,在做相关的操作
 
 

以上是关于IllegalArgumentException: requirement failed: Corrupt index found的主要内容,如果未能解决你的问题,请参考以下文章

IllegalArgumentException:无效的列纬度

Retrofit-IllegalArgumentException:意外的 url

引起:java.lang.IllegalArgumentException:属性'driverClassName'不能为空

IllegalArgumentException:接收方未注册

IllegalArgumentException 介绍

java.lang.IllegalArgumentException:基本 URI 不能为空