You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by ho...@apache.org on 2024/05/29 02:26:36 UTC
(incubator-gluten) branch main updated: [GLUTEN-4422][CORE] Fix core dump caused by spill on closed iterator (#5874)
This is an automated email from the ASF dual-hosted git repository.
hongze pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 79c681b28 [GLUTEN-4422][CORE] Fix core dump caused by spill on closed iterator (#5874)
79c681b28 is described below
commit 79c681b2847fccd43292d3d735bc3972eacb3b52
Author: WangGuangxin <wa...@bytedance.com>
AuthorDate: Wed May 29 10:26:32 2024 +0800
[GLUTEN-4422][CORE] Fix core dump caused by spill on closed iterator (#5874)
Closes #4422
---
cpp/core/jni/JniWrapper.cc | 4 ++++
.../java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/cpp/core/jni/JniWrapper.cc b/cpp/core/jni/JniWrapper.cc
index a04ba73a1..f5a6c4bd7 100644
--- a/cpp/core/jni/JniWrapper.cc
+++ b/cpp/core/jni/JniWrapper.cc
@@ -544,6 +544,10 @@ JNIEXPORT jlong JNICALL Java_org_apache_gluten_vectorized_ColumnarBatchOutIterat
auto ctx = gluten::getRuntime(env, wrapper);
auto it = ctx->objectStore()->retrieve<ResultIterator>(iterHandle);
+ if (it == nullptr) {
+ std::string errorMessage = "Invalid result iter handle " + std::to_string(iterHandle);
+ throw gluten::GlutenException(errorMessage);
+ }
return it->spillFixedSize(size);
JNI_METHOD_END(kInvalidResourceHandle)
}
diff --git a/gluten-data/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java b/gluten-data/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java
index 82b398439..37de98943 100644
--- a/gluten-data/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java
+++ b/gluten-data/src/main/java/org/apache/gluten/vectorized/ColumnarBatchOutIterator.java
@@ -80,7 +80,11 @@ public class ColumnarBatchOutIterator extends GeneralOutIterator implements Runt
}
public long spill(long size) {
- return nativeSpill(iterHandle, size);
+ if (!closed.get()) {
+ return nativeSpill(iterHandle, size);
+ } else {
+ return 0L;
+ }
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org