kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject kafka git commit: KAFKA-4725; Stop leaking messages in produce request body when requests are delayed
Date Tue, 07 Feb 2017 23:13:02 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.2 aca81877f -> bec105d48


KAFKA-4725; Stop leaking messages in produce request body when requests are delayed

This change is in response to [KAFKA-4725](https://issues.apache.org/jira/browse/KAFKA-4725).

When a produce request is received, if the user/client is exceeding their produce quota, the
response will be delayed until the quota is refilled appropriately.

Unfortunately, the request body is still referenced in the callback which in turn leaks the
messages contained within the request.

This change allows the `KafkaApis` method to take ownership of the request body from the `RequestChannel.Request`
object.

I am not sure whether this breaks other invariants which are assumed within other parts of
Kafka.

Author: Tim Carey-Smith <tim@spork.in>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jun Rao <junrao@gmail.com>

Closes #2496 from halorgium/fix-throttled-response-leak

(cherry picked from commit 7f6bf5d44796ac14665d5ba8c2243f5d7f5d30bd)
Signed-off-by: Jun Rao <junrao@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/bec105d4
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/bec105d4
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/bec105d4

Branch: refs/heads/0.10.2
Commit: bec105d48a5cce57080fec949da48cb79f4c1994
Parents: aca8187
Author: Tim Carey-Smith <tim@spork.in>
Authored: Tue Feb 7 15:12:47 2017 -0800
Committer: Jun Rao <junrao@gmail.com>
Committed: Tue Feb 7 15:12:58 2017 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/kafka/common/requests/ProduceRequest.java  | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/bec105d4/clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java b/clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java
index e4a2aae..bd3ae8f 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java
@@ -160,6 +160,7 @@ public class ProduceRequest extends AbstractRequest {
     }
 
     public void clearPartitionRecords() {
+        struct.clear();
         partitionRecords.clear();
     }
 


Mime
View raw message