Issue Details (XML | Word | Printable)

Key: DERBY-210
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Kathey Marsden
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Derby

Network Server will leak prepared statements if not explicitly closed by the user until the connection is closed

Created: 11/Apr/05 10:07 AM   Updated: 10/Jul/09 09:48 PM
Return to search
Component/s: Network Client
Affects Version/s: 10.0.2.0
Fix Version/s: None

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works derby-210-patch1.diff 2006-02-11 04:10 AM Deepa Remesh 2 kB
File Licensed for inclusion in ASF works derby-210-patch2.diff 2006-02-11 07:52 AM Deepa Remesh 8 kB
File Licensed for inclusion in ASF works derby-210-patch2.status 2006-02-11 07:52 AM Deepa Remesh 0.6 kB
File Licensed for inclusion in ASF works derby-210-patch3.diff 2006-02-14 02:45 AM Deepa Remesh 0.8 kB
File Licensed for inclusion in ASF works derby-210-patch4-v2.diff 2006-02-15 04:56 AM Deepa Remesh 6 kB
File Licensed for inclusion in ASF works derby-210-patch4-v2.status 2006-02-15 04:56 AM Deepa Remesh 0.1 kB
File Licensed for inclusion in ASF works derby-210-patch4-v3.diff 2006-02-25 04:43 AM Deepa Remesh 7 kB
File Licensed for inclusion in ASF works derby-210-patch4-v3.status 2006-02-25 04:43 AM Deepa Remesh 0.1 kB
File Licensed for inclusion in ASF works derby-210-patch5-v1.diff 2006-03-02 10:35 AM Deepa Remesh 10 kB
File Licensed for inclusion in ASF works derby-210-patch5-v1.status 2006-03-02 10:35 AM Deepa Remesh 0.4 kB
File Licensed for inclusion in ASF works derby-210-v2-draft.diff 2006-02-10 03:35 AM Deepa Remesh 19 kB
File Licensed for inclusion in ASF works derby-210-v2-draft.status 2006-02-10 03:35 AM Deepa Remesh 0.8 kB
Java Source File Licensed for inclusion in ASF works derbyStress.java 2005-04-11 10:17 AM Kathey Marsden 12 kB
Text File Licensed for inclusion in ASF works runtimeinfo_DOTS-OOME.txt 2006-03-08 04:52 PM John H. Embretsen 32 kB
Java Source File Licensed for inclusion in ASF works StatementStress.java 2006-03-04 02:06 AM John H. Embretsen 17 kB
Image Attachments:

1. DOTS_ATCJ2_Derby-noPatch.png
(6 kB)

2. DOTS_ATCJ2_Derby-withPatch.png
(7 kB)
Issue Links:
Incorporates
 

Urgency: Normal

Sub-Tasks  All   Open   

 Description  « Hide
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.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.