Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-6416

Potential divide by zero issue in InputGateMetrics#refreshAndGetAvg()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.0, 1.4.0
    • Fix Version/s: 1.3.0, 1.4.0
    • Component/s: Metrics, Network
    • Labels:
      None

      Description

          int count = 0;
      
          for (InputChannel channel : inputGate.getInputChannels().values()) {
            if (channel instanceof RemoteInputChannel) {
              RemoteInputChannel rc = (RemoteInputChannel) channel;
      
              int size = rc.unsynchronizedGetNumberOfQueuedBuffers();
              total += size;
              ++count;
            }
          }
      
          return total / (float) count;
      

      If count is zero at the end of the loop, the division would produce exception.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Zentol Chesnay Schepler
                Reporter:
                yuzhihong@gmail.com Ted Yu
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: