You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Dmitry Ryabkov (JIRA)" <ji...@apache.org> on 2016/02/25 20:49:18 UTC

[jira] [Commented] (ZOOKEEPER-2376) Server fails to start if there is a zero-length TxnLog file present in the log directory

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15167745#comment-15167745 ] 

Dmitry Ryabkov commented on ZOOKEEPER-2376:
-------------------------------------------

In v3.4.6 the corresponding code which can create the zero-length file is in FileTxnLog.java, lines 205 - 211. If line 205 is executed but the process crashes or exits with an exception before executing line 211 a txn log file without a header is created.

> 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)