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

Manikumar updated KAFKA-6787:
-----------------------------
    Description: 
{code}
java.lang.NullPointerException at 
org.apache.kafka.common.metrics.stats.SampledStat.purgeObsoleteSamples(SampledStat.java:104)
 at 
org.apache.kafka.common.metrics.stats.SampledStat.measure(SampledStat.java:74) 
at org.apache.kafka.common.metrics.KafkaMetric.metricValue(KafkaMetric.java:68) 
at kafka.api.QuotaTestClients$.metricValue(BaseQuotaTest.scala:163) at 
kafka.api.QuotaTestClients.produceUntilThrottled(BaseQuotaTest.scala:193) at 
kafka.api.BaseQuotaTest.testThrottledProducerConsumer(BaseQuotaTest.scala:84)
 {code}

{code:java}
    protected void purgeObsoleteSamples(MetricConfig config, long now) {
        long expireAge = config.samples() * config.timeWindowMs();
        for (Sample sample : samples) {
            if (now - sample.lastWindowMs >= expireAge)  // line 104, sample is 
null, probably is a concurrent issue
                sample.reset(now);
        }
    }
{code}

  was:
java.lang.NullPointerException at 
org.apache.kafka.common.metrics.stats.SampledStat.purgeObsoleteSamples(SampledStat.java:104)
 at 
org.apache.kafka.common.metrics.stats.SampledStat.measure(SampledStat.java:74) 
at org.apache.kafka.common.metrics.KafkaMetric.metricValue(KafkaMetric.java:68) 
at kafka.api.QuotaTestClients$.metricValue(BaseQuotaTest.scala:163) at 
kafka.api.QuotaTestClients.produceUntilThrottled(BaseQuotaTest.scala:193) at 
kafka.api.BaseQuotaTest.testThrottledProducerConsumer(BaseQuotaTest.scala:84)

 
{code:java}
    protected void purgeObsoleteSamples(MetricConfig config, long now) {
        long expireAge = config.samples() * config.timeWindowMs();
        for (Sample sample : samples) {
            if (now - sample.lastWindowMs >= expireAge)  // line 104, sample is 
null, probably is a concurrent issue
                sample.reset(now);
        }
    }
{code}


> enumerate SampledStat.samples got null item
> -------------------------------------------
>
>                 Key: KAFKA-6787
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6787
>             Project: Kafka
>          Issue Type: Bug
>          Components: metrics
>    Affects Versions: 1.1.0
>            Reporter: Qiang Zhao
>            Priority: Critical
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> {code}
> java.lang.NullPointerException at 
> org.apache.kafka.common.metrics.stats.SampledStat.purgeObsoleteSamples(SampledStat.java:104)
>  at 
> org.apache.kafka.common.metrics.stats.SampledStat.measure(SampledStat.java:74)
>  at 
> org.apache.kafka.common.metrics.KafkaMetric.metricValue(KafkaMetric.java:68) 
> at kafka.api.QuotaTestClients$.metricValue(BaseQuotaTest.scala:163) at 
> kafka.api.QuotaTestClients.produceUntilThrottled(BaseQuotaTest.scala:193) at 
> kafka.api.BaseQuotaTest.testThrottledProducerConsumer(BaseQuotaTest.scala:84)
>  {code}
> {code:java}
>     protected void purgeObsoleteSamples(MetricConfig config, long now) {
>         long expireAge = config.samples() * config.timeWindowMs();
>         for (Sample sample : samples) {
>             if (now - sample.lastWindowMs >= expireAge)  // line 104, sample 
> is null, probably is a concurrent issue
>                 sample.reset(now);
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to