[ 
http://issues.apache.org/jira/browse/DERBY-210?page=comments#action_12363585 ] 

Bryan Pendleton commented on DERBY-210:
---------------------------------------

Hi Deepa, thanks very much for posting your research, it was extremely 
interesting.

I'm not sure I agree with Kathey, though. My expectation was that garbage 
collecting a Statement *is* the same as close, and so I think your 
implementation is correct and the test is not written precisely enough.

Here's an interesting post from a Sun web page:
http://forum.java.sun.com/thread.jspa?threadID=689539&messageID=4018996

It seems to me like the next step is to try to study the specs and clarify the 
requirements: what exactly is it supposed to mean to garbage collect a 
Statement object?


> 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: derby-210.diff, derby-210.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

Reply via email to