This is an automated email from the ASF dual-hosted git repository.
cgivre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new 95a6c93578 DRILL-8484: HashJoinPOP Memory Leak is Caused by an OOM
Exception when read data from Stream with container (#2889)
95a6c93578 is described below
commit 95a6c93578f76bc411b5888e134c54328cecf5ff
Author: shfshihuafeng <[email protected]>
AuthorDate: Sat Mar 30 05:29:32 2024 +0800
DRILL-8484: HashJoinPOP Memory Leak is Caused by an OOM Exception when
read data from Stream with container (#2889)
---
.../drill/exec/cache/VectorAccessibleSerializable.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java
index 2b85d7912b..e9214df415 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java
@@ -25,6 +25,7 @@ import java.io.OutputStream;
import java.util.List;
import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.exec.exception.OutOfMemoryException;
import org.apache.drill.exec.expr.TypeHelper;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.metrics.DrillMetrics;
@@ -164,14 +165,22 @@ public class VectorAccessibleSerializable extends
AbstractStreamSerializable {
for (SerializedField metaData : fieldList) {
final int dataLength = metaData.getBufferLength();
final MaterializedField field = MaterializedField.create(metaData);
- final DrillBuf buf = allocator.buffer(dataLength);
- final ValueVector vector;
+ DrillBuf buf = null;
+ ValueVector vector = null;
try {
+ buf = allocator.buffer(dataLength);
buf.writeBytes(input, dataLength);
vector = TypeHelper.getNewVector(field, allocator);
vector.load(metaData, buf);
+ } catch (OutOfMemoryException oom) {
+ for (ValueVector valueVector : vectorList) {
+ valueVector.clear();
+ }
+ throw UserException.memoryError(oom).message("Allocator memory
failed").build(logger);
} finally {
- buf.release();
+ if (buf != null) {
+ buf.release();
+ }
}
vectorList.add(vector);
}