[
https://issues.apache.org/jira/browse/HBASE-27995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17829309#comment-17829309
]
ConfX commented on HBASE-27995:
-------------------------------
Hi [~ryakhovskiy.k], do you think we can resolve this issue by logging a
warning and returning an empty block instead of null here?
> Missing null check in TestHFile
> --------------------------------
>
> Key: HBASE-27995
> URL: https://issues.apache.org/jira/browse/HBASE-27995
> Project: HBase
> Issue Type: Sub-task
> Reporter: ConfX
> Priority: Critical
> Attachments: HBASE-27995.patch, 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)