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:55:02 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.1 850ceb74c -> 2e0b9a70d


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/2e0b9a70
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/2e0b9a70
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/2e0b9a70

Branch: refs/heads/0.10.1
Commit: 2e0b9a70d0163a1817ca2371aea503ec16f25f8c
Parents: 850ceb7
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:54:03 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/2e0b9a70/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 c7d41e6..986f592 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
@@ -127,6 +127,7 @@ public class ProduceRequest extends AbstractRequest {
     }
 
     public void clearPartitionRecords() {
+        struct.clear();
         partitionRecords.clear();
     }
 


Mime
View raw message