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

Potential divide by zero issue in InputGateMetrics#refreshAndGetAvg()

    XMLWordPrintableJSON

Details

    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

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

              Dates

                Created:
                Updated:
                Resolved: