[ https://issues.apache.org/jira/browse/HBASE-27989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17832313#comment-17832313 ]
Hudson commented on HBASE-27989: -------------------------------- Results for branch branch-2.5 [build #503 on builds.a.o|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/503/]: (/) *{color:green}+1 overall{color}* ---- details (if available): (/) {color:green}+1 general checks{color} -- For more information [see general report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/503/General_20Nightly_20Build_20Report/] (/) {color:green}+1 jdk8 hadoop2 checks{color} -- For more information [see jdk8 (hadoop2) report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/503/JDK8_20Nightly_20Build_20Report_20_28Hadoop2_29/] (/) {color:green}+1 jdk8 hadoop3 checks{color} -- For more information [see jdk8 (hadoop3) report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/503/JDK8_20Nightly_20Build_20Report_20_28Hadoop3_29/] (/) {color:green}+1 jdk11 hadoop3 checks{color} -- For more information [see jdk11 report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/503/JDK11_20Nightly_20Build_20Report_20_28Hadoop3_29/] (/) {color:green}+1 source release artifact{color} -- See build output for details. (/) {color:green}+1 client integration test{color} > ByteBuffAllocator causes ArithmeticException due to improper poolBufSize > value checking > --------------------------------------------------------------------------------------- > > Key: HBASE-27989 > URL: https://issues.apache.org/jira/browse/HBASE-27989 > Project: HBase > Issue Type: Sub-task > Components: BucketCache > Reporter: ConfX > Assignee: ConfX > Priority: Critical > Labels: pull-request-available > Fix For: 2.4.18, 2.7.0, 3.0.0-beta-2, 2.6.1, 2.5.9 > > Attachments: reproduce.sh > > > h3. What happened > There is no value checking for parameter > {{{}hbase.server.allocator.buffer.size{}}}. This may cause improper > calculations and crashes the system like division by 0. > h3. Buggy code > In {{{}ByteBuffAllocator.java{}}}, there is no value checking for > {{poolBufSize}} and this variable is directly used to calculate the > {{{}bufsForTwoMB{}}}. When {{poolBufSize}} is mistakenly set to 0, the code > would cause division by 0 and throw ArithmeticException to crash the system. > {noformat} > public static ByteBuffAllocator create(Configuration conf, boolean > reservoirEnabled) { > int poolBufSize = conf.getInt(BUFFER_SIZE_KEY, DEFAULT_BUFFER_SIZE); > if (reservoirEnabled) { > . . . > int bufsForTwoMB = (2 * 1024 * 1024) / poolBufSize; > . . .{noformat} > h3. How to reproduce > # set hbase.server.allocator.buffer.size=0 > run > # > org.apache.hadoop.hbase.io.hfile.bucket.TestBucketCacheRefCnt#testInBucketCache > # you should observe the following failure: > {noformat} > java.lang.ArithmeticException: / by zero > at > org.apache.hadoop.hbase.io.ByteBuffAllocator.create(ByteBuffAllocator.java:174) > at > org.apache.hadoop.hbase.io.hfile.bucket.TestBucketCacheRefCnt.testInBucketCache(TestBucketCacheRefCnt.java:224) > . . .{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)