db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepa Remesh (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-210) Network Server will leak prepared statements if not explicitly closed by the user until the connection is closed
Date Fri, 10 Feb 2006 22:53:58 GMT
     [ http://issues.apache.org/jira/browse/DERBY-210?page=all ]

Deepa Remesh updated DERBY-210:
-------------------------------

    Attachment: derby-210-patch2.diff
                derby-210-patch2.status

Attaching second patch 'derby-210-patch2.diff' which adds a test to jdbcapi suite for this
issue. Patch does the following:

* Adds a test derbyStress.java to jdbcapi suite. This test is based on the repro for this
patch.
* Excludes the new test from running with client driver, jcc and j9 because it gives out of
memory error. Once derby-210 is resolved, this test should pass with client driver and the
exclude must be removed from DerbyNetClient.exclude
* Creates 'derbyStress_app.properties' with following property 'jvmflags=-Xmx64M' to guarantee
the test fails on all machines with the current client driver. 

I ran jdbcapi suite with all frameworks using Sun JDK1.4.2 on Windows XP. Verified that the
new test gets run with embedded and is skipped for client and jcc frameworks. Also ran the
new test with j9 vms. Verified it passes with j9_foundation and is skipped for other j9s.
Please take a look at this patch. 

> Network Server will leak prepared statements if not explicitly closed by the user until
the connection is closed
> ----------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-210
>          URL: http://issues.apache.org/jira/browse/DERBY-210
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Reporter: Kathey Marsden
>     Assignee: Deepa Remesh
>  Attachments: DOTS_ATCJ2_Derby-noPatch.png, DOTS_ATCJ2_Derby-withPatch.png, derby-210-patch1.diff,
derby-210-patch2.diff, derby-210-patch2.status, derby-210-v2-draft.diff, derby-210-v2-draft.status,
derbyStress.java
>
> Network server will not garbage collect prepared statements that are not explicitly closed
by the user.  So  a loop like this will leak.
> ...
> PreparedStatement ps;
>  for (int i = 0 ; i  < numPs; i++)
> 	{
> 	 ps = conn.prepareStatement(selTabSql);
> 	 rs =ps.executeQuery();
> 	 while (rs.next())
> 	{
> 	    rs.getString(1);
> 	}
> 	rs.close();
> 	// I'm a sloppy java programmer
> 	//ps.close();
> 	}
> 			
> To reproduce run the attached program 
> java derbyStress
> Both client and server will grow until the connection is closed.
>  
> It is likely that the fix for this will have to be in the client.  The client does not
send protocol to close the prepared statement, but rather reuses the PKGNAMCSN on the PRPSQLSTT
request once the prepared statement has been closed. This is how the server knows to close
the old statement and create a new one.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message