kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: HOTFIX: failing to close this iterator causes leaks in rocksdb
Date Fri, 11 Nov 2016 14:36:24 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk d8fa4006c -> 0fc1898bf


HOTFIX: failing to close this iterator causes leaks in rocksdb

guozhangwang dguy

Author: dan norwood <norwood@confluent.io>

Reviewers: Damian Guy, Michael G. Noll, Guozhang Wang

Closes #2122 from norwood/close-call


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

Branch: refs/heads/trunk
Commit: 0fc1898bf6b91ac5f79dbf3da7ebc90da410876d
Parents: d8fa400
Author: Dan Norwood <norwood@confluent.io>
Authored: Fri Nov 11 06:36:15 2016 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Fri Nov 11 06:36:15 2016 -0800

----------------------------------------------------------------------
 .../kafka/streams/state/internals/CachingWindowStore.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/0fc1898b/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
b/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
index 7ff4044..304a206 100644
--- a/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
+++ b/streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java
@@ -160,11 +160,11 @@ class CachingWindowStore<K, V> implements WindowStore<K, V>,
CachedStateStore<Wi
     }
 
     private V fetchPrevious(final Bytes key, final long timestamp) {
-        final WindowStoreIterator<byte[]> iterator = underlying.fetch(key, timestamp,
timestamp);
-        if (!iterator.hasNext()) {
-            return null;
+        try (final WindowStoreIterator<byte[]> iterator = underlying.fetch(key, timestamp,
timestamp)) {
+            if (!iterator.hasNext()) {
+                return null;
+            }
+            return serdes.valueFrom(iterator.next().value);
         }
-        return serdes.valueFrom(iterator.next().value);
     }
-
 }


Mime
View raw message