flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Yu (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLINK-6416) Potential divide by zero issue in InputGateMetrics#refreshAndGetAvg()
Date Fri, 28 Apr 2017 15:46:04 GMT
Ted Yu created FLINK-6416:
-----------------------------

             Summary: Potential divide by zero issue in InputGateMetrics#refreshAndGetAvg()
                 Key: FLINK-6416
                 URL: https://issues.apache.org/jira/browse/FLINK-6416
             Project: Flink
          Issue Type: Bug
            Reporter: Ted Yu
            Priority: Minor


{code}
    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;
{code}
If count is zero at the end of the loop, the division would produce exception.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message