一、问题描述
启动项目solr服务器,突然发现打印“[recoveryExecutor-5-thread-1] ERROR org.apache.solr.update.UpdateLog – java.io.EOFException”异常,之前好好的,具体异常如下所示
java.io.EOFException@b@ at org.apache.solr.common.util.FastInputStream.readUnsignedByte(FastInputStream.java:73)@b@ at org.apache.solr.common.util.FastInputStream.readInt(FastInputStream.java:216)@b@ at org.apache.solr.update.TransactionLog$FSReverseReader.next(TransactionLog.java:732)@b@ at org.apache.solr.update.UpdateLog$RecentUpdates.update(UpdateLog.java:947)@b@ at org.apache.solr.update.UpdateLog$RecentUpdates.access$000(UpdateLog.java:885)@b@ at org.apache.solr.update.UpdateLog.getRecentUpdates(UpdateLog.java:1042)@b@ at org.apache.solr.update.UpdateLog.init(UpdateLog.java:272)@b@ at org.apache.solr.update.UpdateHandler.<init>(UpdateHandler.java:134)@b@ at org.apache.solr.update.UpdateHandler.<init>(UpdateHandler.java:94)@b@ at org.apache.solr.update.DirectUpdateHandler2.<init>(DirectUpdateHandler2.java:96)@b@ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)@b@ at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)@b@ at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)@b@ at java.lang.reflect.Constructor.newInstance(Constructor.java:408)@b@ at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:537)@b@ at org.apache.solr.core.SolrCore.createUpdateHandler(SolrCore.java:607)@b@ at org.apache.solr.core.SolrCore.<init>(SolrCore.java:819)@b@ at org.apache.solr.core.SolrCore.<init>(SolrCore.java:629)@b@ at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:622)@b@ at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657)@b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364)@b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:266)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:266)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)@b@ at java.lang.Thread.run(Thread.java:745)@b@ ...@b@ 6884 [recoveryExecutor-5-thread-1] INFO org.apache.solr.core.SolrCore – SolrDeletionPolicy.onInit: commits: num=1@b@commit{dir=C:/NJ/XWDSpace/xwood-solr/solr-md/subject/data/index,segFN=segments_2,generation=2}@b@6894 [recoveryExecutor-5-thread-1] INFO org.apache.solr.core.SolrCore – newest commit generation = 2@b@6973 [recoveryExecutor-5-thread-1] INFO org.apache.solr.search.SolrIndexSearcher – Opening Searcher@dfe59b realtime@b@7223 [recoveryExecutor-5-thread-1] ERROR org.apache.solr.update.UpdateLog – java.io.EOFException@b@ at org.apache.solr.common.util.FastInputStream.readFully(FastInputStream.java:154)@b@ at org.apache.solr.common.util.JavaBinCodec.readStr(JavaBinCodec.java:479)@b@ at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:176)@b@ at org.apache.solr.common.util.JavaBinCodec.readSolrInputDocument(JavaBinCodec.java:374)@b@ at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:225)@b@ at org.apache.solr.common.util.JavaBinCodec.readArray(JavaBinCodec.java:451)@b@ at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:182)@b@ at org.apache.solr.update.TransactionLog$LogReader.next(TransactionLog.java:624)@b@ at org.apache.solr.update.UpdateLog$LogReplayer.doReplay(UpdateLog.java:1259)@b@ at org.apache.solr.update.UpdateLog$LogReplayer.run(UpdateLog.java:1202)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:266)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:266)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)@b@ at java.lang.Thread.run(Thread.java:745)
二、解决步骤
根据EOFException和异常日志,判定初始化索引文件造成的 - 应该是索引文件坏蛋了(之前重建索引为完成就终止服务或索引被部分删除等),
1. 直接删除索引文件(如将路径../solr-md/subject/data下的index和tlog文件都删除)
2. 重启solr服务,不再报错
3. 重建索引