[
https://issues.apache.org/jira/browse/FLINK-6416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16010371#comment-16010371
]
ASF GitHub Bot commented on FLINK-6416:
---------------------------------------
GitHub user zentol opened a pull request:
https://github.com/apache/flink/pull/3906
[FLINK-6416] Fix divide-by-zero in InputGateMetrics
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zentol/flink 6416_metrics_zero
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/3906.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #3906
----
commit 3772253a59f79667082d8fe599d85ad3590d7907
Author: zentol <[email protected]>
Date: 2017-05-15T11:44:54Z
[FLINK-6416] Fix divide-by-zero in InputGateMetrics
----
> 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
> Components: Metrics, Network
> Affects Versions: 1.3.0, 1.4.0
> Reporter: Ted Yu
> Assignee: Chesnay Schepler
> Priority: Minor
> Fix For: 1.3.0, 1.4.0
>
>
> {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)