Support Questions

Find answers, ask questions, and share your expertise

Hbase bucket cache causing Hmaster to go down

We recently upgraded from ambari 2.2 to 2.5 and hdp from 2.4 to 2.6. We have hbase bucket cache enabled. But after the upgrade hbase master is continuously failing. the exception is shown below. But once we disabled the bucket cache, the hbase master process is coming up. How to fix this?

java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster
        at org.apache.hadoop.hbase.master.HMaster.constructMaster(
        at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(
        at org.apache.hadoop.hbase.master.HMaster.main(
Caused by: java.lang.OutOfMemoryError: Direct buffer memory
        at java.nio.Bits.reserveMemory(
        at java.nio.DirectByteBuffer.<init>(
        at java.nio.ByteBuffer.allocateDirect(
        at org.apache.hadoop.hbase.util.ByteBufferArray.<init>(
        at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(
        at org.apache.hadoop.hbase.master.HMaster.<init>(
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(

seems like you are hitting this bug :

In the HBase config, make sure the following parameters have no values.

- hbase.bucketcache.size

- hbase.bucketcache.ioengine


you can try removing these three configurations using /var/lib/ambari-server/resources/scripts/

For example:

/var/lib/ambari-server/resources/scripts/ delete localhost falconK hbase-site hbase.bucketcache.ioengine

where localhost is my server hostname

Hope this helps @ARUN

Super Collaborator

hi @Arun,

Bucket cache is memory (Off heap) which will be directly accessed from the main memory(RAM), Can you please check are there any memory management errors in /var/log/messages(or syslog). That may indicate any issues with insufficient memory.

There may be cases that, other components(services) in the server increased their usage and hit the 100% mark ( in case of swappiness set to 0).

the following link has a table on how much bucket cache should be allocated in each RS.

Please note that, the computation is considered based of the case that node is worser node, if any other node you must subtract the JVM (xmx size memory of the other components resides in the host)

@Akhil S Naik, Thanks for your answer. but it wont help our case. we already had the bucket cache enabled and we are making use of it. SO removing the bucket cache is not a good option for us as we need to retain that.

These were our values

hbase.bucketcache.size = 92160 MB

MaxDirectMemorySize=94208 MB

@arun, you need to set -XX:MaxDirectMemorySize=<more_than_bucket_cache_size> in HBASE_MASTER_OPTS also. as master internaly starts a regionserver for some tasks.

export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:MaxDirectMemorySize=<more_than_bucket_cache_size>"

@Ankit Singhal,

we have set this as shown below


and our bucket cache size is 92160 mb

This was working perfectly before the upgrade.

92 GB(max direct memory) > 90 GB (bucket cache)

we will try setting on the master one also and get back

you need to set the same for Master opts as well as described in my last comment.