openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2329) OpenJPA should close JDBC metadata (and all) statements
Date Thu, 07 Feb 2013 15:27:14 GMT


Kathey Marsden commented on OPENJPA-2329:

Again appologies for my lack of OpenJPA knowledge. I am a Derby engineer, not  really  in
a position to look at the OpenJPA code. I observed the possible issue with a Derby tool. I
had asked the user to run:

java org.apache.derby.drda.NetworkServerControl runtimeinfo which yielded many calls to SYSIBM.SQLCOLUMNS

Prepared Statement Information: 
	Stmt ID		SQLText
	-------------	-----------

Which would correspond to DatabaseMetaData.getColumns()

Also there were many

Which would correspond to getImportedKeys()

Perhaps looking for calls to these methods and DatabaseMetaData in the OpenJPA code would
show the result sets whose statements are not closed. It is not intuitive to close them as
you never create the statement explicitly but can get at it with ResultSet.getStatement()

I am not sure if there are other DatabaseMetaData calls that might be in OpenJPA that are
not closed, but these are the ones that showed up in Derby runtimeinfo.
It would have been better  for the OpenJPA user to file this but he just said he didn't have
time, so I thought I would file something vague here, even though I have limited visibility
from where Derby is in the picture.

> OpenJPA should close JDBC metadata (and all) statements 
> --------------------------------------------------------
>                 Key: OPENJPA-2329
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>         Environment: SuSE linux vm loaded to the point that garbage collection not likely
to kick in
>            Reporter: Kathey Marsden
> Please close all JDBC Metadata statements after execution  in OpenJPA to avoid a potential
interaction issue with Derby Network Client.  See details at:
> The statement can be obtained with ResultSet.getStatement() e.g.
>       for (int i = 0; i < 50000; i++) {
>                 ResultSet rs = conn.getMetaData().getSchemas();
>                 while ( {
>                     //System.out.println("SCHEM NAME = " + rs.getString(1));
>                 }
>                 rs.getStatement().close();  <====
>             } 
> In debugging a recent DERBY client/OpenJPA interaction issue, I saw in  that  there were
a fair number of JDBC metadata Result Sets that  did not get cleaned up until garbage collection
kicked in. 
> There is a program in-lined in  the description of DERBY-6055 that shows how metadata
statements can build up and could potentially exceed the maximum number of sections if garbage
collection did not kick in on time on a loaded system. 
> Sorry for the lack of OpenJPA version detail and repro as I don't have any personal experience
with OpenJPA and was not able to get information on OpenJPA version from the user.  The user's
primary statement issue was a different so they did not have time to follow up on this potential

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

View raw message