Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-13339

MetricsSourceAdapter#updateAttrCache may throw NPE due to NULL lastRecs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None

    Description

      The for loop below may find lastRecs NULL

        private int updateAttrCache() {
          LOG.debug("Updating attr cache...");
          int recNo = 0;
          int numMetrics = 0;
          for (MetricsRecordImpl record : lastRecs) {
            for (MetricsTag t : record.tags()) {
              setAttrCacheTag(t, recNo);
              ++numMetrics;
            }
            for (AbstractMetric m : record.metrics()) {
              setAttrCacheMetric(m, recNo);
              ++numMetrics;
            }
            ++recNo;
          }
          LOG.debug("Done. # tags & metrics="+ numMetrics);
          return numMetrics;
        }
      

      and throws NPE.

      Attachments

        Issue Links

          Activity

            People

              yzhangal Yongjun Zhang
              yzhangal Yongjun Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: