You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (Created) (JIRA)" <ji...@apache.org> on 2012/04/02 20:51:23 UTC

[jira] [Created] (DERBY-5683) BaseJDBCTestCase.getDatabaseProperty() should close resources before returning

BaseJDBCTestCase.getDatabaseProperty() should close resources before returning
------------------------------------------------------------------------------

                 Key: DERBY-5683
                 URL: https://issues.apache.org/jira/browse/DERBY-5683
             Project: Derby
          Issue Type: Improvement
          Components: Test
    Affects Versions: 10.9.0.0
            Reporter: Knut Anders Hatlen
            Assignee: Knut Anders Hatlen
            Priority: Minor


BaseJDBCTestCase.getDatabaseProperty() creates a PreparedStatement and a ResultSet that are not closed before the method returns. If a test case calls getDatabaseProperty() many times, the open statements may have a big memory footprint.

This can be seen for example by running jdbcapi.AuthenticationTest with -Xmx64. It will fail with an OutOfMemoryError when testNoCollisionsWithConfigurableHash() runs in client/server mode.

--
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] (DERBY-5683) BaseJDBCTestCase.getDatabaseProperty() should close resources before returning

Posted by "Knut Anders Hatlen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-5683:
--------------------------------------

    Attachment: d5683-1a-close-and-forget.diff

Attaching a patch that makes getDatabaseProperty() close the ResultSet and PreparedStatement before returning the property value. It also removes the PreparedStatement from the list of statements to close at tearDown(). With these changes, AuthenticationTest completes successfully in my environment when running with -Xmx64.
                
> BaseJDBCTestCase.getDatabaseProperty() should close resources before returning
> ------------------------------------------------------------------------------
>
>                 Key: DERBY-5683
>                 URL: https://issues.apache.org/jira/browse/DERBY-5683
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 10.9.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d5683-1a-close-and-forget.diff
>
>
> BaseJDBCTestCase.getDatabaseProperty() creates a PreparedStatement and a ResultSet that are not closed before the method returns. If a test case calls getDatabaseProperty() many times, the open statements may have a big memory footprint.
> This can be seen for example by running jdbcapi.AuthenticationTest with -Xmx64. It will fail with an OutOfMemoryError when testNoCollisionsWithConfigurableHash() runs in client/server mode.

--
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] (DERBY-5683) BaseJDBCTestCase.getDatabaseProperty() should close resources before returning

Posted by "Dag H. Wanvik (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13245660#comment-13245660 ] 

Dag H. Wanvik commented on DERBY-5683:
--------------------------------------

Looks like an improvement. +1 Nit: the new name closeStatement doesn't convey the semantics for "forgetting/removing" the statement from "statements". What about "removeStatement"?
 
                
> BaseJDBCTestCase.getDatabaseProperty() should close resources before returning
> ------------------------------------------------------------------------------
>
>                 Key: DERBY-5683
>                 URL: https://issues.apache.org/jira/browse/DERBY-5683
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 10.9.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d5683-1a-close-and-forget.diff
>
>
> BaseJDBCTestCase.getDatabaseProperty() creates a PreparedStatement and a ResultSet that are not closed before the method returns. If a test case calls getDatabaseProperty() many times, the open statements may have a big memory footprint.
> This can be seen for example by running jdbcapi.AuthenticationTest with -Xmx64. It will fail with an OutOfMemoryError when testNoCollisionsWithConfigurableHash() runs in client/server mode.

--
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] (DERBY-5683) BaseJDBCTestCase.getDatabaseProperty() should close resources before returning

Posted by "Knut Anders Hatlen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-5683:
--------------------------------------

    Issue & fix info: Patch Available
    
> BaseJDBCTestCase.getDatabaseProperty() should close resources before returning
> ------------------------------------------------------------------------------
>
>                 Key: DERBY-5683
>                 URL: https://issues.apache.org/jira/browse/DERBY-5683
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 10.9.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d5683-1a-close-and-forget.diff
>
>
> BaseJDBCTestCase.getDatabaseProperty() creates a PreparedStatement and a ResultSet that are not closed before the method returns. If a test case calls getDatabaseProperty() many times, the open statements may have a big memory footprint.
> This can be seen for example by running jdbcapi.AuthenticationTest with -Xmx64. It will fail with an OutOfMemoryError when testNoCollisionsWithConfigurableHash() runs in client/server mode.

--
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] [Resolved] (DERBY-5683) BaseJDBCTestCase.getDatabaseProperty() should close resources before returning

Posted by "Knut Anders Hatlen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen resolved DERBY-5683.
---------------------------------------

          Resolution: Fixed
       Fix Version/s: 10.9.0.0
    Issue & fix info:   (was: Patch Available)

Thanks for reviewing the patch, Dag.

I think I prefer to keep the name "closeStatement", as the logical operation of the method is to close the statement. Removing it from the "statements" list is just internal bookkeeping. Also, the "closeStatement" method is the inverse of the "createStatement", "prepareStatement" and "prepareCall" methods in BaseJDBCTestCase, which don't have the "remembering/adding" aspect reflected in their names.

Committed revision 1310413.
                
> BaseJDBCTestCase.getDatabaseProperty() should close resources before returning
> ------------------------------------------------------------------------------
>
>                 Key: DERBY-5683
>                 URL: https://issues.apache.org/jira/browse/DERBY-5683
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 10.9.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.9.0.0
>
>         Attachments: d5683-1a-close-and-forget.diff
>
>
> BaseJDBCTestCase.getDatabaseProperty() creates a PreparedStatement and a ResultSet that are not closed before the method returns. If a test case calls getDatabaseProperty() many times, the open statements may have a big memory footprint.
> This can be seen for example by running jdbcapi.AuthenticationTest with -Xmx64. It will fail with an OutOfMemoryError when testNoCollisionsWithConfigurableHash() runs in client/server mode.

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