You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Newson (JIRA)" <ji...@apache.org> on 2008/07/03 19:33:45 UTC

[jira] Created: (LUCENE-1326) Inflater.end() method not always called in FieldsReader

Inflater.end() method not always called in FieldsReader
-------------------------------------------------------

                 Key: LUCENE-1326
                 URL: https://issues.apache.org/jira/browse/LUCENE-1326
             Project: Lucene - Java
          Issue Type: Bug
    Affects Versions: 2.3.1
            Reporter: Robert Newson



We've just found an insidious memory leak in our own application as we did not always call Deflater.end() and Inflater.end(). As documented here;

http://bugs.sun.com/view_bug.do?bug_id=4797189

The non-heap memory that the native zlib code uses is not freed in a timely manner.

FieldsWriter appears safe as no exception can be thrown between the Deflater's creation and end() as it uses a ByteArrayOutputStream

FieldsReader, however, is not safe. In the event of a DataFormatException the call to end() will not occur.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1326) Inflater.end() method not always called in FieldsReader

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610315#action_12610315 ] 

Robert Newson commented on LUCENE-1326:
---------------------------------------


You're welcome and thanks for the quick response!

By the way, our specific issue was with DeflaterOutputStream.close(). It only calls end() on the deflater if it created it itself, so this;

dos = new DeflaterOutputStream();
try {
 ...
} finally {
  dos.close();
}

frees all resources but this does not;

dos = new DeflaterOutputStream(new Deflater(Deflater.BEST_COMPRESSION, true));
try {
 ...
} finally {
  dos.close();
}

You have to call Deflater.end() *yourself* if you make one when you pass it in. close() is not sufficient.




> Inflater.end() method not always called in FieldsReader
> -------------------------------------------------------
>
>                 Key: LUCENE-1326
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1326
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.3.1
>            Reporter: Robert Newson
>
> We've just found an insidious memory leak in our own application as we did not always call Deflater.end() and Inflater.end(). As documented here;
> http://bugs.sun.com/view_bug.do?bug_id=4797189
> The non-heap memory that the native zlib code uses is not freed in a timely manner.
> FieldsWriter appears safe as no exception can be thrown between the Deflater's creation and end() as it uses a ByteArrayOutputStream
> FieldsReader, however, is not safe. In the event of a DataFormatException the call to end() will not occur.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1326) Inflater.end() method not always called in FieldsReader

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610312#action_12610312 ] 

Uwe Schindler commented on LUCENE-1326:
---------------------------------------

I think a try {} finally {} around both places should be enough.

P.S.: Thank you for the comment, I fixed a missing close() around DeflaterOutputStream/InflaterInputStream and GZIP pendants in two of my servlets and a OAI harvester with Lucene.

> Inflater.end() method not always called in FieldsReader
> -------------------------------------------------------
>
>                 Key: LUCENE-1326
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1326
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.3.1
>            Reporter: Robert Newson
>
> We've just found an insidious memory leak in our own application as we did not always call Deflater.end() and Inflater.end(). As documented here;
> http://bugs.sun.com/view_bug.do?bug_id=4797189
> The non-heap memory that the native zlib code uses is not freed in a timely manner.
> FieldsWriter appears safe as no exception can be thrown between the Deflater's creation and end() as it uses a ByteArrayOutputStream
> FieldsReader, however, is not safe. In the event of a DataFormatException the call to end() will not occur.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1326) Inflater.end() method not always called in FieldsReader

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

Michael McCandless resolved LUCENE-1326.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4

> Inflater.end() method not always called in FieldsReader
> -------------------------------------------------------
>
>                 Key: LUCENE-1326
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1326
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.3.1
>            Reporter: Robert Newson
>            Assignee: Michael McCandless
>             Fix For: 2.4
>
>
> We've just found an insidious memory leak in our own application as we did not always call Deflater.end() and Inflater.end(). As documented here;
> http://bugs.sun.com/view_bug.do?bug_id=4797189
> The non-heap memory that the native zlib code uses is not freed in a timely manner.
> FieldsWriter appears safe as no exception can be thrown between the Deflater's creation and end() as it uses a ByteArrayOutputStream
> FieldsReader, however, is not safe. In the event of a DataFormatException the call to end() will not occur.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Assigned: (LUCENE-1326) Inflater.end() method not always called in FieldsReader

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

Michael McCandless reassigned LUCENE-1326:
------------------------------------------

    Assignee: Michael McCandless

> Inflater.end() method not always called in FieldsReader
> -------------------------------------------------------
>
>                 Key: LUCENE-1326
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1326
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.3.1
>            Reporter: Robert Newson
>            Assignee: Michael McCandless
>
> We've just found an insidious memory leak in our own application as we did not always call Deflater.end() and Inflater.end(). As documented here;
> http://bugs.sun.com/view_bug.do?bug_id=4797189
> The non-heap memory that the native zlib code uses is not freed in a timely manner.
> FieldsWriter appears safe as no exception can be thrown between the Deflater's creation and end() as it uses a ByteArrayOutputStream
> FieldsReader, however, is not safe. In the event of a DataFormatException the call to end() will not occur.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1326) Inflater.end() method not always called in FieldsReader

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610489#action_12610489 ] 

Michael McCandless commented on LUCENE-1326:
--------------------------------------------

I'll commit a try/finally for both FieldsReader & FieldsWriter.  Thanks Robert!

> Inflater.end() method not always called in FieldsReader
> -------------------------------------------------------
>
>                 Key: LUCENE-1326
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1326
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.3.1
>            Reporter: Robert Newson
>            Assignee: Michael McCandless
>
> We've just found an insidious memory leak in our own application as we did not always call Deflater.end() and Inflater.end(). As documented here;
> http://bugs.sun.com/view_bug.do?bug_id=4797189
> The non-heap memory that the native zlib code uses is not freed in a timely manner.
> FieldsWriter appears safe as no exception can be thrown between the Deflater's creation and end() as it uses a ByteArrayOutputStream
> FieldsReader, however, is not safe. In the event of a DataFormatException the call to end() will not occur.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org