[ https://issues.apache.org/jira/browse/ZOOKEEPER-2376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15167788#comment-15167788 ]
Dmitry Ryabkov commented on ZOOKEEPER-2376: ------------------------------------------- One of the possible fixes would be to model FileTxnLog after FileSnap which skips over the "broken" files in its deserialize() method. > Server fails to start if there is a zero-length TxnLog file present in the > log directory > ---------------------------------------------------------------------------------------- > > Key: ZOOKEEPER-2376 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2376 > Project: ZooKeeper > Issue Type: Bug > Components: server > Affects Versions: 3.4.6 > Environment: Windows > Reporter: Dmitry Ryabkov > > If there is an empty TxnLog file in the log file folder, ZooKeeper server > fails to start. This is the exception it logs: > 2015-11-02 07:41:10.479 -0600 (,,,) main : ERROR > org.apache.zookeeper.server.ZooKeeperServerMain - Unexpected exception, > exiting abnormally > java.io.EOFException > at java.io.DataInputStream.readInt(DataInputStream.java:392) > at > org.apache.jute.BinaryInputArchive.readInt(BinaryInputArchive.java:63) > at > org.apache.zookeeper.server.persistence.FileHeader.deserialize(FileHeader.java:64) > at > org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.inStreamCreated(FileTxnLog.java:576) > at > org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.createInputArchive(FileTxnLog.java:595) > at > org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.goToNextLog(FileTxnLog.java:561) > at > org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.next(FileTxnLog.java:643) > at > org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:158) > at > org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:223) > at > org.apache.zookeeper.server.ZooKeeperServer.loadData(ZooKeeperServer.java:272) > at > org.apache.zookeeper.server.ZooKeeperServer.startdata(ZooKeeperServer.java:399) > at > org.apache.zookeeper.server.NIOServerCnxnFactory.startup(NIOServerCnxnFactory.java:122) > at > org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:113) > at > org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:86) > at > org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:52) > at > org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116) > at > org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78) > Zero-length log file can be created if FileTxnLog.append() crashes after it > creates FileOutputStream but before it serializes and flushes the header. -- This message was sent by Atlassian JIRA (v6.3.4#6332)