[jbosscache-issues] [JBoss JIRA] Created: (JBCACHE-1454) Memory leak in CacheStoreInterceptor

Krzysztof Sobolewski (JIRA) jira-events at lists.jboss.org
Fri Dec 19 09:12:54 EST 2008


Memory leak in CacheStoreInterceptor
------------------------------------

                 Key: JBCACHE-1454
                 URL: https://jira.jboss.org/jira/browse/JBCACHE-1454
             Project: JBoss Cache
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Cache loaders
    Affects Versions: 3.0.1.GA, 2.2.1.CR1
            Reporter: Krzysztof Sobolewski
            Assignee: Manik Surtani


The CacheStoreInterceptor leaks Fqns with asynchronous replication (and in local mode, I guess).
CacheStoreInterceptor remembers modifications in handlePrepareCommand() and later is supposed to clear it on commit/rollback. The failure is that async turns on one phase commit, in which transaction commit sends PrepareCommand only (instead of Prepare + Commit/Rollback). This way the interceptor accumulates modifications for transactions long gone (in preparingTxs and txStores Maps)

I *think* the patch below should fix it, at least for 2.2. It looks like in 3.0 it is even more leaky: onePhase is always(?) false (so the patch won't help) and the preparingTxs are removed from only with optimistic locking (or after exception; or rollback).

The patch:

Index: src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	(revision 6986)
+++ src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java	(working copy)
@@ -371,10 +371,13 @@
       {
          loader.prepare(gtx, modsBuilder.modifications, onePhase);
 
-         preparingTxs.put(gtx, modsBuilder.affectedFqns);
-         if (getStatisticsEnabled() && modsBuilder.putCount > 0)
+         if (!onePhase)
          {
-            txStores.put(gtx, modsBuilder.putCount);
+            preparingTxs.put(gtx, modsBuilder.affectedFqns);
+            if (getStatisticsEnabled() && modsBuilder.putCount > 0)
+            {
+               txStores.put(gtx, modsBuilder.putCount);
+            }
          }
       }
    }


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

        



More information about the jbosscache-issues mailing list