db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Matrigali (JIRA)" <j...@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 Jul 2009 21:49:14 GMT

     [ https://issues.apache.org/jira/browse/DERBY-210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mike Matrigali updated DERBY-210:
---------------------------------

    Urgency: Normal

Triaged July 10, 2009: assigned normal urgency. 

> Network Server will leak prepared statements if not explicitly closed by the user until
the connection is closed
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-210
>                 URL: https://issues.apache.org/jira/browse/DERBY-210
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.0.2.0
>            Reporter: Kathey Marsden
>         Attachments: derby-210-patch1.diff, derby-210-patch2.diff, derby-210-patch2.status,
derby-210-patch3.diff, derby-210-patch4-v2.diff, derby-210-patch4-v2.status, derby-210-patch4-v3.diff,
derby-210-patch4-v3.status, derby-210-patch5-v1.diff, derby-210-patch5-v1.status, derby-210-v2-draft.diff,
derby-210-v2-draft.status, derbyStress.java, DOTS_ATCJ2_Derby-noPatch.png, DOTS_ATCJ2_Derby-withPatch.png,
runtimeinfo_DOTS-OOME.txt, StatementStress.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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message