You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Yiqun Lin (JIRA)" <ji...@apache.org> on 2016/05/27 03:11:12 UTC

[jira] [Updated] (HADOOP-13210) MetricsSinkAdapter always reset retryDelay and retryCount

     [ https://issues.apache.org/jira/browse/HADOOP-13210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yiqun Lin updated HADOOP-13210:
-------------------------------
    Status: Patch Available  (was: Open)

Attach a patch for this.

> MetricsSinkAdapter always reset retryDelay and retryCount
> ---------------------------------------------------------
>
>                 Key: HADOOP-13210
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13210
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: metrics
>            Reporter: Yiqun Lin
>         Attachments: HADOOP-13210.001.patch
>
>
> In {{MetricsSinkAdapter#publishMetricsFromQueue}}, it always reset the {{retryDelay}} and {{retryCount}} in each loop.
> {code}
>   void publishMetricsFromQueue() {
>     int retryDelay = firstRetryDelay;
>     int n = retryCount;
>     int minDelay = Math.min(500, retryDelay * 1000); // millis
>     Random rng = new Random(System.nanoTime());
>     while (!stopping) {
>       try {
>         queue.consumeAll(this);
>         refreshQueueSizeGauge();
>         retryDelay = firstRetryDelay;
>         n = retryCount;
>         inError = false;
>       } catch (InterruptedException e) {
>         LOG.info(name +" thread interrupted.");
>       } catch (Exception e) {
>         if (n > 0) {
>           int retryWindow = Math.max(0, 1000 / 2 * retryDelay - minDelay);
>           int awhile = rng.nextInt(retryWindow) + minDelay;
>           if (!inError) {
>             LOG.error("Got sink exception, retry in "+ awhile +"ms", e);
>           }
>           retryDelay *= retryBackoff;
>           try { Thread.sleep(awhile); }
>           catch (InterruptedException e2) {
>             LOG.info(name +" thread interrupted while waiting for retry", e2);
>           }
>           --n;
>         } else {
>           if (!inError) {
>             LOG.error("Got sink exception and over retry limit, "+
>                       "suppressing further error messages", e);
>           }
>           queue.clear();
>           refreshQueueSizeGauge();
>           inError = true; // Don't keep complaining ad infinitum
>         }
>       }
>     }
>   }
> {code}
> It looks the change of these in catch block code will not comes into effect. I think we should remove these two line because the values have been initalized before in {{publishMetricsFromQueue}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org