Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-9019

Ratio calculation of ResourceCalculator implementations could return NaN

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Found out that ResourceCalculator.ratio (with implementors DefaultResourceCalculator and DominantResourceCalculator) can produce NaN (Not-A-Number) as a result.

      This is because IEEE 754 defines 1.0 / 0.0 as Infinity and -1.0 / 0.0 as -Infinity and 0.0 / 0.0 as NaN, see here: https://stackoverflow.com/a/14138032/1106893 

      I think it's very dangerous to rely on NaN can be returned from ratio calculations and this could have side-effects.

      When ratio calculates the result and if both the numerator and the denominator is zero, we should use 0 as a result, I think.

        Attachments

        1. YARN-9019.001.patch
          5 kB
          Szilard Nemeth

        Issue Links

          Activity

            People

            • Assignee:
              snemeth Szilard Nemeth
              Reporter:
              snemeth Szilard Nemeth

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment