You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ted Yu (JIRA)" <ji...@apache.org> on 2017/05/04 21:52:04 UTC

[jira] [Comment Edited] (FLINK-6416) Potential divide by zero issue in InputGateMetrics#refreshAndGetAvg()

    [ https://issues.apache.org/jira/browse/FLINK-6416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15989202#comment-15989202 ] 

Ted Yu edited comment on FLINK-6416 at 5/4/17 9:51 PM:
-------------------------------------------------------

I would think 0 is reasonable return value when both total and count are zero .


was (Author: yuzhihong@gmail.com):
I would think 0 is reasonable return value when both total and count are zero.

> 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)