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

MetricsSourceAdapter#updateAttrCache may throw NPE due to NULL lastRecs

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment