[jbosscache-issues] [JBoss JIRA] Commented: (JBCACHE-1454) Memory leak in CacheStoreInterceptor
Manik Surtani (JIRA)
jira-events at lists.jboss.org
Fri Dec 19 10:25:58 EST 2008
[ https://jira.jboss.org/jira/browse/JBCACHE-1454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12443625#action_12443625 ]
Manik Surtani commented on JBCACHE-1454:
----------------------------------------
Thanks for raising this. In trunk (3.x) there are actually 2 such leaks, in preparingTxs as well as txStores.
I've fixed these in trunk now.
> 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: 2.2.1.CR1, 3.0.1.GA
> 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