This is an automated email from the ASF dual-hosted git repository.
philo-he pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new e06ce29949 [CORE] Do not report an interrupted task as off-heap OOM
(#13147)
e06ce29949 is described below
commit e06ce29949f0af6ae507c3af31287b42e76d2ad8
Author: YangJie <[email protected]>
AuthorDate: Wed Sep 30 03:43:12 2026 -0400
[CORE] Do not report an interrupted task as off-heap OOM (#13147)
---
.../memory/memtarget/ThrowOnOomMemoryTarget.java | 4 +-
.../memtarget/ThrowOnOomMemoryTargetTest.java | 50 ++++++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git
a/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTarget.java
b/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTarget.java
index 395f956fe9..baecf19c68 100644
---
a/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTarget.java
+++
b/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTarget.java
@@ -108,7 +108,9 @@ public class ThrowOnOomMemoryTarget implements MemoryTarget
{
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- break;
+ // A killed/cancelled task must not be reported as an off-heap OOM.
+ throw new RuntimeException(
+ "Interrupted while waiting for enough off-heap memory to be
granted", e);
}
sleepTime *= 2;
sleeps++;
diff --git
a/gluten-core/src/test/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTargetTest.java
b/gluten-core/src/test/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTargetTest.java
new file mode 100644
index 0000000000..2148af1b8c
--- /dev/null
+++
b/gluten-core/src/test/java/org/apache/gluten/memory/memtarget/ThrowOnOomMemoryTargetTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gluten.memory.memtarget;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ThrowOnOomMemoryTargetTest {
+
+ @Test
+ public void testInterruptedBorrowSurfacesInterruptionNotOom() {
+ final MemoryTarget neverGrants =
+ new NoopMemoryTarget() {
+ @Override
+ public long borrow(long size) {
+ return 0L;
+ }
+ };
+ final ThrowOnOomMemoryTarget target = new
ThrowOnOomMemoryTarget(neverGrants);
+
+ // A pre-set interrupt flag makes the first Thread.sleep in the retry loop
+ // throw InterruptedException immediately - the situation of a task killed
+ // while waiting for memory.
+ Thread.currentThread().interrupt();
+ try {
+ target.borrow(1024L);
+ Assert.fail("Expected a RuntimeException carrying the interruption");
+ } catch (RuntimeException e) {
+ Assert.assertTrue(e.getCause() instanceof InterruptedException);
+ } finally {
+ // The handler must have restored the interrupt status; consuming it here
+ // also keeps the flag from leaking into other tests.
+ Assert.assertTrue(Thread.interrupted());
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]