[
https://issues.apache.org/jira/browse/KAFKA-3310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15174365#comment-15174365
]
ASF GitHub Bot commented on KAFKA-3310:
---------------------------------------
GitHub user auradkar opened a pull request:
https://github.com/apache/kafka/pull/989
KAFKA-3310: Fix for NPEs observed when throttling clients.
The fix basically ensures that the throttleTimeSensor is non-null before
handing off to record the metric value. We also record the throttle time to 0
so that we don't recreate the sensor always.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/auradkar/kafka KAFKA-3310
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/989.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 #989
----
commit cd5007eb3c94ae2d1983cc6a4b9a9fe4e96ff1b1
Author: Aditya Auradkar <[email protected]>
Date: 2016-03-01T20:18:59Z
KAFKA-3310: Fix for NPEs observed when throttling clients.
The fix basically ensures that the throttleTimeSensor is non-null before
handing off to record the metric value. We also record the throttle time to 0
so that we don't recreate the sensor always.
----
> fetch requests can trigger repeated NPE when quota is enabled
> -------------------------------------------------------------
>
> Key: KAFKA-3310
> URL: https://issues.apache.org/jira/browse/KAFKA-3310
> Project: Kafka
> Issue Type: Bug
> Affects Versions: 0.9.0.1
> Reporter: Jun Rao
>
> We saw the following NPE when consumer quota is enabled. NPE is triggered on
> every fetch request from the client.
> java.lang.NullPointerException
> at
> kafka.server.ClientQuotaManager.recordAndMaybeThrottle(ClientQuotaManager.scala:122)
> at
> kafka.server.KafkaApis.kafka$server$KafkaApis$$sendResponseCallback$3(KafkaApis.scala:419)
> at
> kafka.server.KafkaApis$$anonfun$handleFetchRequest$1.apply(KafkaApis.scala:436)
> at
> kafka.server.KafkaApis$$anonfun$handleFetchRequest$1.apply(KafkaApis.scala:436)
> at kafka.server.ReplicaManager.fetchMessages(ReplicaManager.scala:481)
> at kafka.server.KafkaApis.handleFetchRequest(KafkaApis.scala:431)
> at kafka.server.KafkaApis.handle(KafkaApis.scala:69)
> at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:60)
> at java.lang.Thread.run(Thread.java:745)
> One possible cause of this is the logic of removing inactive sensors.
> Currently, in ClientQuotaManager, we create two sensors per clientId: a
> throttleTimeSensor and a quotaSensor. Each sensor expires if it's not
> actively updated for 1 hour. What can happen is that initially, the quota is
> not exceeded. So, quotaSensor is being updated actively, but
> throttleTimeSensor is not. At some point, throttleTimeSensor is removed by
> the expiring thread. Now, we are in a situation that quotaSensor is
> registered, but throttleTimeSensor is not. Later on, if the quota is
> exceeded, we will hit the above NPE when trying to update throttleTimeSensor.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)