Yiyuan GUO created HDFS-16029: --------------------------------- Summary: Divide by zero bug in InstrumentationService.java Key: HDFS-16029 URL: https://issues.apache.org/jira/browse/HDFS-16029 Project: Hadoop HDFS Issue Type: Bug Components: security Reporter: Yiyuan GUO
In the file _lib/service/instrumentation/InstrumentationService.java,_ the method _Timer.getValues_ has the following [code|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/instrumentation/InstrumentationService.java#L236]: {code:java} long[] getValues() { ...... int limit = (full) ? size : (last + 1); ...... values[AVG_TOTAL] = values[AVG_TOTAL] / limit; } {code} The variable _limit_ is used as a divisor. However, its value may be equal to _last + 1,_ which can be zero since _last_ is __ initialized to -1 in the [constructor|https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/service/instrumentation/InstrumentationService.java#L222]: {code:java} public Timer(int size) { ... last = -1; } {code} Thus, a divide by zero problem can happen -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org