db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-557) Client driver gets OutOfMemoryError when re-executing statement without closing ResultSet
Date Sat, 11 Feb 2006 22:47:28 GMT
     [ http://issues.apache.org/jira/browse/DERBY-557?page=all ]

Knut Anders Hatlen updated DERBY-557:

    Attachment: DERBY-557-regression-test.diff

Added a test case for DERBY-557 to jdbcapi/derbyStress.java. I have
verified that the test case fails without the fix.

I had to enable the test for DerbyNetClient. Since the test case for
DERBY-210 currently fails under DerbyNetClient, I disabled that test
case in the java code by adding this to prepStmtTest():

  // Don't run under DerbyNetClient until DERBY-210 is fixed
  if (TestUtil.isDerbyNetClientFramework()) return;

Derbyall ran cleanly.

Could someone please review?


> Client driver gets OutOfMemoryError when re-executing statement without closing ResultSet
> -----------------------------------------------------------------------------------------
>          Key: DERBY-557
>          URL: http://issues.apache.org/jira/browse/DERBY-557
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Versions:,,
>     Reporter: Knut Anders Hatlen
>     Assignee: Knut Anders Hatlen
>     Priority: Minor
>      Fix For:,,
>  Attachments: DERBY-557-regression-test.diff, DERBY-557-regression-test.stat, DERBY-557.diff,
DERBY-557.stat, derbyall_report.txt
> When re-executing a statement without closing the old ResultSet, some of the old ResultSet's
resources are not released, and the network client will eventually get an OutOfMemoryError.
> Example:
> 	Connection c = DriverManager.getConnection("jdbc:derby://localhost/mydb");
> 	PreparedStatement ps = c.prepareStatement("select * from sys.systables");
> 	while (true) {
> 		ResultSet rs = ps.executeQuery();
> 	}
> This code will run for some time and then throw an OutOfMemoryError. Same thing happens
with Statement instead of PreparedStatement. If rs.close() is added in the loop, the code
works. Explicitly closing the ResultSet should not be necessary according to this quote from
the JDBC 3.0 spec:
>   For Select statements, the statement is complete when the associated result set is
closed. The result set is closed as soon as one of the following occurs:
>      - all of the rows have been retrieved
>      - the associated Statement object is re-executed
>      - another Statement object is executed on the same connection

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message