[ https://issues.apache.org/jira/browse/HBASE-13301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
zhangduo updated HBASE-13301: ----------------------------- Attachment: HBASE-13301-testcase.patch Only a testcase. A little tricky so I really need other ones help confirming the problem. The flow is: t1 cache a block t2 evict the block but stopped before acquiring offsetLock(this is done by holding the offsetLock with t1 in this testcase) t1 evict the block, and cache the block again. t2 continue evicting the block and find that it is not the block which it should deal with, so just give up and return false. Then we have blockCount=1, and some used spaces in BucketAllocator, but no block in BucketCache. So we have no chance to free the used spaces. > Possible memory leak in BucketCache > ----------------------------------- > > Key: HBASE-13301 > URL: https://issues.apache.org/jira/browse/HBASE-13301 > Project: HBase > Issue Type: Bug > Components: BlockCache > Reporter: zhangduo > Assignee: zhangduo > Attachments: HBASE-13301-testcase.patch > > > {code:title=BucketCache.java} > public boolean evictBlock(BlockCacheKey cacheKey) { > ... > if (bucketEntry.equals(backingMap.remove(cacheKey))) { > bucketAllocator.freeBlock(bucketEntry.offset()); > realCacheSize.addAndGet(-1 * bucketEntry.getLength()); > blocksByHFile.remove(cacheKey.getHfileName(), cacheKey); > if (removedBlock == null) { > this.blockNumber.decrementAndGet(); > } > } else { > return false; > } > ... > {code} > I think the problem is here. We remove a BucketEntry that should not be > removed by us, but we do not put it back and also do not do any clean up. -- This message was sent by Atlassian JIRA (v6.3.4#6332)