ConfX created HBASE-27995: ----------------------------- Summary: Missing null check in TestHFile Key: HBASE-27995 URL: https://issues.apache.org/jira/browse/HBASE-27995 Project: HBase Issue Type: Bug Reporter: ConfX Attachments: reproduce.sh
h2. What happened After setting {{{}hbase.lru.blockcache.hard.capacity.limit.factor=-0.4921875{}}}, running test {{{}org.apache.hadoop.hbase.io.hfile.TestHFile#testReaderWithAdaptiveLruCombinedBlockCache{}}}results in a null pointer exception. h2. Where's the problem In the test: {noformat} cachedBlock = combined.getBlock(key, false, false, true); try { ... } finally { cachedBlock.release(); }{noformat} However, cacheBlock might not be initialized properly and could be null, causing an unhandled NullPointerException. h2. How to reproduce # set {{hbase.lru.blockcache.hard.capacity.limit.factor}} to {{-0.4921875 }} # run {{org.apache.hadoop.hbase.io.hfile.TestHFile#testReaderWithAdaptiveLruCombinedBlockCache}} you should observe {noformat} java.lang.NullPointerException at org.apache.hadoop.hbase.io.hfile.TestHFile.testReaderCombinedCache(TestHFile.java:1052) at org.apache.hadoop.hbase.io.hfile.TestHFile.testReaderWithAdaptiveLruCombinedBlockCache(TestHFile.java:1011){noformat} For an easy reproduction, run the reproduce.sh in the attachment. We are happy to provide a patch if this issue is confirmed. -- This message was sent by Atlassian Jira (v8.20.10#820010)