You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Yiyuan GUO (Jira)" <ji...@apache.org> on 2021/05/19 11:30:00 UTC
[jira] [Created] (HDFS-16029) Divide by zero bug in
InstrumentationService.java
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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org