Bug 728272 - make sure JDBC connections, statements, and resultsets get closed after we are done with them
Summary: make sure JDBC connections, statements, and resultsets get closed after we ar...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.0.1
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: jon3 jon30-perf
TreeView+ depends on / blocked
 
Reported: 2011-08-04 14:43 UTC by Ian Springer
Modified: 2013-08-06 00:40 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-07 19:27:22 UTC
Embargoed:


Attachments (Terms of Use)

Description Ian Springer 2011-08-04 14:43:50 UTC
Coverity reports dozens of places in the RHQ Server code where we don't close connections, statements, and resultsets. Sometimes we don't close them when an exception occurs, and other times we don't close them even in the non-exception case.

In our perf environment, Oracle EM is warning that it has 5000 open cursors. There are probably so many because of the un-closed/abandoned connections, statements, and resultsets.

JBoss AS can be configured to auto-close abandoned connections, statements, and resultsets.

http://community.jboss.org/wiki/WhatDoesTheMessageDoYourOwnHousekeepingMean
http://community.jboss.org/wiki/CanJBossTellMeWhenIDontCloseAConnection

The RHQ Server AS is already configured to auto-close connections, but not to auto-close statements and resultsets. To do the latter, we need to add:

  <track-statements>true</track-statements>

to both of the datasources defined in rhq-ds.xml.

Whenever JBoss auto-closes a connection, statement, and resultset, it logs a nasty warning, so, longer term, we should go through our code and make sure to close the connections, statements, and resultsets ourselves. Coverity will give us a list of all of the culprits.

Comment 1 Ian Springer 2011-08-04 14:53:12 UTC
I added <track-statements>true</track-statements> to each of the RHQ datasources in the perftest branch - commit cbef4d2. Once this has been tested in the perf env, we'll merge it into master.

Comment 2 Robert Buck 2011-09-26 12:56:00 UTC
commit fece00f1862612104aef1439fb02c4f7a35d797e
Author: Robert Buck <rbuck>
Date:   2011-09-26 08:54:05 -0400

oracle em cites lots of open cursor issues; fix open cursor leaks by closing result sets and prepared statements in finally blocks.

Comment 3 Mike Foley 2011-09-29 19:44:03 UTC
verified general functionality through successful automation run.

Comment 4 Mike Foley 2012-02-07 19:27:22 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE


Note You need to log in before you can comment on or make changes to this bug.