Bug 728272 - make sure JDBC connections, statements, and resultsets get closed after we are done with them
make sure JDBC connections, statements, and resultsets get closed after we ar...
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
4.0.1
Unspecified Unspecified
low Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: jon3 jon30-perf
  Show dependency treegraph
 
Reported: 2011-08-04 10:43 EDT by Ian Springer
Modified: 2013-08-05 20:40 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-02-07 14:27:22 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ian Springer 2011-08-04 10:43:50 EDT
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 10:53:12 EDT
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 08:56:00 EDT
commit fece00f1862612104aef1439fb02c4f7a35d797e
Author: Robert Buck <rbuck@redhat.com>
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 15:44:03 EDT
verified general functionality through successful automation run.
Comment 4 Mike Foley 2012-02-07 14:27:22 EST
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.