You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Rakesh R (JIRA)" <ji...@apache.org> on 2011/09/16 16:30:09 UTC

[jira] [Created] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
----------------------------------------------------------------------------------------

                 Key: ZOOKEEPER-1189
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
             Project: ZooKeeper
          Issue Type: Bug
          Components: server
    Affects Versions: 3.3.3
            Reporter: Rakesh R
             Fix For: 3.3.4


When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.

{noformat}
Util.isValidSnapshot() having the following logic. 
       // Check for a valid snapshot
        RandomAccessFile raf = new RandomAccessFile(f, "r");
        // including the header and the last / bytes
        // the snapshot should be atleast 10 bytes
        if (raf.length() < 10) {
            return false;
        }
{noformat}

Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.

Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Reed updated ZOOKEEPER-1189:
-------------------------------------

    Hadoop Flags: [Incompatible change, Reviewed]  (was: [Incompatible change])

+1 looks great!

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>             Fix For: 3.3.4
>
>         Attachments: ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114164#comment-13114164 ] 

Mahadev konar commented on ZOOKEEPER-1189:
------------------------------------------

@rakesh,
 Can you please provide a patch for 3.3 branch? The patch seems to apply to both 3.4 and 3.5 but does not apply to 3.3 branch.


> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Rakesh R (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115200#comment-13115200 ] 

Rakesh R commented on ZOOKEEPER-1189:
-------------------------------------

Thanks Mahadev, for reviewing and committing the patch.

-Rakesh
                
> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189-branch-3.3.patch, ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-1189:
------------------------------------

    Fix Version/s: 3.5.0
                   3.4.0

Let's make sure this is fixed in all active branches (currently 3.3.4, 3.4.0 and 3.5.0 (ie trunk))


> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rakesh R updated ZOOKEEPER-1189:
--------------------------------

    Attachment: ZOOKEEPER-1189.patch

Attached the patch, Please review the fix.

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>             Fix For: 3.3.4
>
>         Attachments: ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114533#comment-13114533 ] 

Rakesh R commented on ZOOKEEPER-1189:
-------------------------------------

Hi Mahadev,

I have attached the patch [ZOOKEEPER-1189-branch-3.3.patch] for the 3.3 branch. Please review this.

Thanks,
Rakesh

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189-branch-3.3.patch, ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106519#comment-13106519 ] 

Hadoop QA commented on ZOOKEEPER-1189:
--------------------------------------

+1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12494800/ZOOKEEPER-1189.patch
  against trunk revision 1170886.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/555//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/555//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/555//console

This message is automatically generated.

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>             Fix For: 3.3.4
>
>         Attachments: ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar reassigned ZOOKEEPER-1189:
----------------------------------------

    Assignee: Rakesh R

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4
>
>         Attachments: ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114532#comment-13114532 ] 

Hadoop QA commented on ZOOKEEPER-1189:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12496448/ZOOKEEPER-1189-branch-3.3.patch
  against trunk revision 1173949.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    -1 patch.  The patch command could not apply the patch.

Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/588//console

This message is automatically generated.

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189-branch-3.3.patch, ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13107981#comment-13107981 ] 

Hadoop QA commented on ZOOKEEPER-1189:
--------------------------------------

+1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12495094/ZOOKEEPER-1189.1.patch
  against trunk revision 1172406.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/561//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/561//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/561//console

This message is automatically generated.

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rakesh R updated ZOOKEEPER-1189:
--------------------------------

    Attachment: ZOOKEEPER-1189-branch-3.3.patch

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189-branch-3.3.patch, ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115399#comment-13115399 ] 

Hudson commented on ZOOKEEPER-1189:
-----------------------------------

Integrated in ZooKeeper-trunk #1316 (See [https://builds.apache.org/job/ZooKeeper-trunk/1316/])
    ZOOKEEPER-1189. For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking. (Rakesh R via mahadev)

mahadev : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1176144
Files : 
* /zookeeper/trunk/CHANGES.txt
* /zookeeper/trunk/src/java/main/org/apache/zookeeper/server/persistence/Util.java
* /zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerTest.java

                
> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189-branch-3.3.patch, ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Mahadev konar (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115069#comment-13115069 ] 

Mahadev konar commented on ZOOKEEPER-1189:
------------------------------------------

Thanks Rakesh, will go ahead and commit.
                
> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189-branch-3.3.patch, ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rakesh R updated ZOOKEEPER-1189:
--------------------------------

    Attachment: ZOOKEEPER-1189.1.patch

Improved the testcase: Added assertion message.

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1189) For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

Posted by "Rakesh R (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13109544#comment-13109544 ] 

Rakesh R commented on ZOOKEEPER-1189:
-------------------------------------

Thanks very much Benjamin, Mahadev, Pat for looking at this.

> For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.
> ----------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1189
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1189
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.3.3
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.3.4, 3.4.0, 3.5.0
>
>         Attachments: ZOOKEEPER-1189.1.patch, ZOOKEEPER-1189.patch
>
>
> When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.
> {noformat}
> Util.isValidSnapshot() having the following logic. 
>        // Check for a valid snapshot
>         RandomAccessFile raf = new RandomAccessFile(f, "r");
>         // including the header and the last / bytes
>         // the snapshot should be atleast 10 bytes
>         if (raf.length() < 10) {
>             return false;
>         }
> {noformat}
> Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.
> Suggestion: Move the validation logic to the try/catch block.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira