[ 
https://issues.apache.org/jira/browse/HBASE-27986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated HBASE-27986:
-----------------------------------
    Labels: pull-request-available  (was: )

> Null Pointer Exception when running testLruBlockCache with a misconfiguration
> -----------------------------------------------------------------------------
>
>                 Key: HBASE-27986
>                 URL: https://issues.apache.org/jira/browse/HBASE-27986
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: ConfX
>            Priority: Critical
>              Labels: pull-request-available
>         Attachments: reproduce.sh
>
>
> h2. What happened
> After setting {{{}hfile.block.cache.size=1.1175870895385742E-8{}}}, running 
> test 
> {{org.apache.hadoop.hbase.io.hfile.TestBlockCacheReporting#testLruBlockCache}}
>  results in a {{{}NullPointerException{}}}.
> h2. Where's the bug
> In the test 
> {{{}org.apache.hadoop.hbase.io.hfile.TestBlockCacheReporting#testLruBlockCache{}}}:
> {code:java}
>     BlockCache blockCache = BlockCacheFactory.createBlockCache(this.conf);
>     logPerBlock(blockCache);
>     addDataAndHits(blockCache, 3); {code}
> Here the returned blockCache could be null, but is directly used as the 
> parameter of {{logPerBlock}} without checking.
> h2. How to reproduce
>  # Set {{hfile.block.cache.size=1.1175870895385742E-8}}
>  # Run 
> {{org.apache.hadoop.hbase.io.hfile.TestBlockCacheReporting#testLruBlockCache}}
> and the following exception should be observed:
> {code:java}
> java.lang.NullPointerException        at 
> org.apache.hadoop.hbase.io.hfile.TestBlockCacheReporting.logPerBlock(TestBlockCacheReporting.java:147)
>        at 
> org.apache.hadoop.hbase.io.hfile.TestBlockCacheReporting.testLruBlockCache(TestBlockCacheReporting.java:100)
>  {code}
> {{}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to