Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-16029

Divide by zero bug in InstrumentationService.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • libhdfs

    Description

      In the file lib/service/instrumentation/InstrumentationService.java, the method 
      Timer.getValues has the following code:

      long[] getValues() {
          ......
          int limit = (full) ? size : (last + 1);
          ......
          values[AVG_TOTAL] = values[AVG_TOTAL] / limit;
      }
      

      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:

      public Timer(int size) {
          ...
          last = -1;
      }
      

      Thus, a divide by zero problem can happen.
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            Yiyuan GUO Yiyuan GUO
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: