Connection.close() should close its statements

Bug #790759 reported by Patric
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
BoneCP
Fix Released
High
Wallace Wadge

Bug Description

Currently, BoneCP requires that all statements must be closed.
Otherwise, this may result in an OutOfMemoryError.

In fact this is violating the jdbc spec:

9.4.4 Closing Connection Objects
An application calls the method Connection.close to indicate that it has finished
using a connection. All Statement objects created from a given Connection object
will be closed when the close method for the object is called.

It should be sufficient to close the connection. It is no error when not closing statements.
(even it's a questionable style).

See also http://jolbox.com/forum/viewtopic.php?f=3&t=253

Wallace Wadge (wwadge)
Changed in bonecp:
status: New → Confirmed
importance: Undecided → Wishlist
assignee: nobody → Wallace Wadge (wwadge)
Revision history for this message
Patric (patric) wrote :

Hi Wallace,

please note that this is not an enhancement request/wish, but a bug report with high priority, because BoneCP, which implements parts of the jdbc specification, violates the latter.

We have much "old" software code in production which do not close statements (but the connection), which is a completely correct behavior.
Without fixing this bug it would be complicated to use BoneCP as a replacement for our propritary connection pooling.

As a result, this bug has an high importance to me and may even be a blocker for BoneCP for the use within our projects.

Revision history for this message
Wallace Wadge (wwadge) wrote :

Fair enough - bumping priority.

Changed in bonecp:
importance: Wishlist → High
Revision history for this message
Wallace Wadge (wwadge) wrote :

Fixed in 0.8.0-SNAPSHOT.

New config options:

/** If true, track statements and close them if application forgot to do so. See also:
  * detectUnclosedStatements. */
 boolean closeOpenStatements;
 /** If true, print out a stack trace of where a statement was opened but not closed before
  * the connection was closed. See also: closeOpenStatements. */
  boolean detectUnclosedStatements;

Changed in bonecp:
status: Confirmed → Fix Committed
Revision history for this message
Patric (patric) wrote :

Thanks, Wallace.
The unclosed statements will be closed during Connection.close(), not later, right?

Revision history for this message
Wallace Wadge (wwadge) wrote :

That's correct - closed upon calling connection.close() -- right away even before releaseHelperThreads come into play.

Revision history for this message
everflux (tklaunchpad) wrote :

Wallace, it would be great if you could perform a release of BoneCP: There are so many fixes after the last 0.7.1 release already commited but can not yet be used due to the SNAPSHOT version. (Snapshot dependencies prevent a maven release and self-packaging is obviously a bad option.)

Revision history for this message
Wallace Wadge (wwadge) wrote :

Hi everflux,

After a long while*, I've resumed bonecp work; expect a release sooner rather than later now

* newborn kids have that effect :-/

Revision history for this message
Kevin (kevinshlee) wrote :

I'm just wondering when we can have the 0.8.0.RELEASE version with this issue fixed.

Wallace Wadge (wwadge)
Changed in bonecp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.