You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/04/28 14:08:48 UTC
[iotdb] branch master updated: Fix NPE (#5722)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 8f8dfa281a Fix NPE (#5722)
8f8dfa281a is described below
commit 8f8dfa281a1e50bc4b6d542770a240cd5b2fb128
Author: Zhong Wang <wa...@alibaba-inc.com>
AuthorDate: Thu Apr 28 22:08:43 2022 +0800
Fix NPE (#5722)
---
server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java | 4 +++-
server/src/main/java/org/apache/iotdb/db/mpp/memory/MemoryPool.java | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
index 6037ab8779..b56ea90a5d 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
@@ -214,7 +214,9 @@ public class SourceHandle implements ISourceHandle {
if (blocked != null && !blocked.isDone()) {
blocked.cancel(true);
}
- bufferRetainedSizeInBytes -= localMemoryManager.getQueryPool().tryCancel(blockedOnMemory);
+ if (blockedOnMemory != null) {
+ bufferRetainedSizeInBytes -= localMemoryManager.getQueryPool().tryCancel(blockedOnMemory);
+ }
sequenceIdToDataBlockSize.clear();
if (bufferRetainedSizeInBytes > 0) {
localMemoryManager
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/memory/MemoryPool.java b/server/src/main/java/org/apache/iotdb/db/mpp/memory/MemoryPool.java
index 14950ed94c..e47504ad0e 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/memory/MemoryPool.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/memory/MemoryPool.java
@@ -141,11 +141,11 @@ public class MemoryPool {
* return 0.
*/
public synchronized long tryCancel(ListenableFuture<Void> future) {
+ Validate.notNull(future);
+ // If the future is not a MemoryReservationFuture, it must have been completed.
if (future.isDone()) {
return 0L;
}
-
- Validate.notNull(future);
Validate.isTrue(
future instanceof MemoryReservationFuture,
"invalid future type " + future.getClass().getSimpleName());