[jboss-jira] [JBoss JIRA] Created: (JBMESSAGING-1227) Statement leak in HandleBeforeCommit1PCRunner

Kevin Conner (JIRA) jira-events at lists.jboss.org
Wed Jan 30 18:13:15 EST 2008


Statement leak in HandleBeforeCommit1PCRunner
---------------------------------------------

                 Key: JBMESSAGING-1227
                 URL: http://jira.jboss.com/jira/browse/JBMESSAGING-1227
             Project: JBoss Messaging
          Issue Type: Bug
    Affects Versions: 1.4.0.SP3
            Reporter: Kevin Conner
         Assigned To: Tim Fox
            Priority: Blocker


>From JBESB-1450

"This leak appears to be coming from JBoss Messaging, specifically JDBCPersistenceManager$1HandleBeforeCommit1PCRunner.doTransaction(JDBCPersistenceManager.java:1587)

This line creates a prepared statement within a loop but only the last statement created will be released. Other examples of this construct, within this file, use a simple guard to prevent subsequent allocations. This appears to be the only occurrence which does not."

"The following change fixes the leak.

Index: src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java (revision 3648)
+++ src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java (working copy)
@@ -1584,8 +1584,11 @@
                   ChannelRefPair pair = (ChannelRefPair) i.next();
                   MessageReference ref = pair.ref;
 
- psReference = conn
+ if (psReference == null)
+ {
+ psReference = conn
                         .prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
+ }
 
                   // Now store the reference
                   addReference(pair.channelID, ref, psReference, false);
"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list