TransactionTable HashMap
mraccola Dec 11, 2007 11:46 PMOur application is currently experiencing signs of a memory leak. We have analyzed the heap dumps and have traced the largest block of memory back to a HashMap in org.jboss.cache.TransactionTable.
I stepped through the code and found that on every put to the cache 2 transaction entries are written to the "txs" and "tx_map" but only 1 is removed, leaking one entry per put. The entry which is leaked is initiated from (TreeCache.put(Fqn, Object, Object) line: 3845). The entry which is properly cleaned up is from (TxInterceptor.handleNonTxMethod(MethodCall) line: 361).
Here is the code used to do the cache put
Option option = new Option(); option.setFailSilently(true); Fqn keyFqn = new Fqn(new Object[]{this.regionFqn, key}); cacheRegion.getCache().put(keyFqn, ITEM, value, option);
Environment: WebSphere 6.1 + JBC 1.4.1.SP4
Here is a relevant portion of the heap dump:
440,293,704 (43%) [7,600] 948 array of EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ad66a9e68 2,019,968 (0%) [72] 3 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ad4f95450 2,019,832 (0%) [112] 8 org/jboss/cache/OptimisticTransactionEntry 0x2ad4f94a50 64 (0%) [64] 2 org/jboss/cache/GlobalTransaction 0x2ad4f949e8 608 (0%) [304] 6 class EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x20d3500 1,722,808 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2af73f8eb8 1,435,344 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2af0e735d8 287,328 (0%) [112] 8 org/jboss/cache/OptimisticTransactionEntry 0x2af73f84b8 64 (0%) [64] 2 org/jboss/cache/GlobalTransaction 0x2af73f8450 608 (0%) [304] 6 class EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x20d3500 1,701,592 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ae6e62bb8 1,616,768 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ae4011d00 1,581,112 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ac8576428 1,535,568 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2af4759d10 1,511,600 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2afb2b8468 1,482,928 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2af4aa4ff8 1,462,016 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2af53ac168 1,455,736 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2add5ee428 1,263,912 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ab8b32dd0 1,249,912 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ae51d9a60 1,245,624 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2af0ef8a20 1,237,912 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2aee239508 1,223,040 (0%) [72] 3 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ade5f4ea0 1,218,040 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2aef3095c8 1,199,520 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2afe8d0880 1,169,392 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2b00dfd6d0 1,165,664 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2af05c79f0 1,151,128 (0%) [72] 4 EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap$Entry 0x2ac35487b8 There are 928 more children