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

Rakesh R commented on ZOOKEEPER-1459:
-------------------------------------

This change would cause the following exception, I couldn't get the reason now. 
Please run the tests ReadOnlyModeTest#testReadOnlyClient and see it.

{code}
2014-05-20 18:02:39,766 [myid:] - ERROR 
[SyncThread:1:ZooKeeperCriticalThread@47] - Severe unrecoverable error, from 
thread : SyncThread:1
java.nio.channels.ClosedChannelException
        at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:88)
        at sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:243)
        at 
org.apache.zookeeper.server.persistence.Util.padLogFile(Util.java:215)
        at 
org.apache.zookeeper.server.persistence.FileTxnLog.padFile(FileTxnLog.java:239)
        at 
org.apache.zookeeper.server.persistence.FileTxnLog.append(FileTxnLog.java:217)
        at 
org.apache.zookeeper.server.persistence.FileTxnSnapLog.append(FileTxnSnapLog.java:372)
        at org.apache.zookeeper.server.ZKDatabase.append(ZKDatabase.java:542)
        at 
org.apache.zookeeper.server.SyncRequestProcessor.run(SyncRequestProcessor.java:122)
{code}

I've gone through your code. Since you have handle to "FileTxnSnapLog ftxn", 
after the server#shutdown() please close ftxn.close() in your code. Could you 
use ZooKeeperServerMain#initializeAndRun() and ZooKeeperServerMain#shutdown() 
for embedding the standalone server ?

I feel  ZOOKEEPER-1072 could be addressed to define the interfaces clearly to 
the users.



> Standalone ZooKeeperServer is not closing the transaction log files on 
> shutdown
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1459
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1459
>             Project: ZooKeeper
>          Issue Type: Sub-task
>          Components: server
>    Affects Versions: 3.4.0
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.4.6, 3.5.0
>
>         Attachments: ZOOKEEPER-1459-branch-3_4.patch, 
> ZOOKEEPER-1459-branch-3_4.patch, ZOOKEEPER-1459.patch, ZOOKEEPER-1459.patch, 
> ZOOKEEPER-1459.patch, ZOOKEEPER-1459.patch, ZOOKEEPER-1459.patch, 
> ZOOKEEPER-1459.patch, ZOOKEEPER-1459.patch, ZOOKEEPER-1459.patch
>
>
> When shutdown the standalone ZK server, its only clearing the zkdatabase and 
> not closing the transaction log streams. When tries to delete the temporary 
> files in unit tests on windows, its failing.
> ZooKeeperServer.java
> {noformat}
>         if (zkDb != null) {
>             zkDb.clear();
>         }
> {noformat}
> Suggestion to close the zkDb as follows, this inturn will take care 
> transaction logs:
> {noformat}
>         if (zkDb != null) {
>             zkDb.clear();
>             try {
>                 zkDb.close();
>             } catch (IOException ie) {
>                 LOG.warn("Error closing logs ", ie);
>             }
>         }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to