This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new a023149fc0 Clarify off-heap OOM error message in JVMStabilityInspector
a023149fc0 is described below
commit a023149fc07774cd37185eb2d6c17f57410e611f
Author: Brandon Williams <[email protected]>
AuthorDate: Fri Oct 23 06:09:50 2026 -0500
Clarify off-heap OOM error message in JVMStabilityInspector
Update the log message in JVMStabilityInspector so operators don't
mistakenly increase heap size when an off-heap OOM occurs. Also fix
the case of "GC overhead limit exceeded" in the force-heap-OOM ignore
set so real GC overhead OOMs are no longer forced.
patch by Isaac Philip Liu; reviewed by Brad Schoening, Brandon Williams for
CASSANDRA-19831
---
CHANGES.txt | 1 +
.../org/apache/cassandra/utils/JVMStabilityInspector.java | 15 ++++++++++-----
.../apache/cassandra/utils/JVMStabilityInspectorTest.java | 11 +++++++----
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index a5655fb2a5..f1cbfbdb27 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
7.0
+ * Clarify off-heap OOM error message in JVMStabilityInspector
(CASSANDRA-19831)
* FQLTool Replay support for full set of login options (CASSANDRA-17559)
* Extract reusable HttpService from cloud metadata connector (CASSANDRA-21195)
* Redact hash and _hash suffixed parameters in system_views.settings
(CASSANDRA-21686)
diff --git a/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
b/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
index 37f5ef3600..17538a2072 100644
--- a/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
+++ b/src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
@@ -189,20 +189,25 @@ public final class JVMStabilityInspector
inspectThrowable(t.getCause(), fn, isUncaughtException);
}
- private static final Set<String> FORCE_HEAP_OOM_IGNORE_SET =
ImmutableSet.of("Java heap space", "GC Overhead limit exceeded");
+ private static final Set<String> FORCE_HEAP_OOM_IGNORE_SET =
ImmutableSet.of("Java heap space", "GC overhead limit exceeded");
+ private static final String DIRECT_BUFFER_OOM_MESSAGE = "direct buffer
memory";
/**
- * Intentionally produce a heap space OOM upon seeing a non heap memory
OOM.
- * Direct buffer OOM cannot trigger JVM OOM error related options,
+ * Intentionally produce a heap space OOM upon seeing an OOM that the JVM
does not treat as a heap OOM.
+ * Such OOMs, direct buffer exhaustion in particular, cannot trigger JVM
OOM error related options,
* e.g. OnOutOfMemoryError, HeapDumpOnOutOfMemoryError, etc.
* See CASSANDRA-15214 and CASSANDRA-17128 for more details
*/
@Exclude // Exclude from just in time compilation.
private static void forceHeapSpaceOomMaybe(OutOfMemoryError oom)
{
- if (FORCE_HEAP_OOM_IGNORE_SET.contains(oom.getMessage()))
+ String message = oom.getMessage();
+ if (FORCE_HEAP_OOM_IGNORE_SET.contains(message))
return;
- logger.error("Force heap space OutOfMemoryError in the presence of",
oom);
+ if (message != null &&
LocalizeString.toLowerCaseLocalized(message).contains(DIRECT_BUFFER_OOM_MESSAGE))
+ logger.error("Off-heap (direct buffer) OutOfMemoryError detected,
forcing a heap OutOfMemoryError to trigger standard JVM OOM handling:", oom);
+ else
+ logger.error("OutOfMemoryError detected, forcing a heap
OutOfMemoryError to trigger standard JVM OOM handling:", oom);
// Start to produce heap space OOM forcibly.
List<long[]> ignored = new ArrayList<>();
while (true)
diff --git
a/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
b/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
index 1ee7a42b13..9d57e44e0b 100644
--- a/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
+++ b/test/unit/org/apache/cassandra/utils/JVMStabilityInspectorTest.java
@@ -195,10 +195,13 @@ public class JVMStabilityInspectorTest
@Test
public void testForceHeapSpaceOomExclude()
{
- OutOfMemoryError error = new OutOfMemoryError("Java heap space");
- Assertions.assertThatThrownBy(() ->
JVMStabilityInspector.inspectThrowable(error))
- .isInstanceOf(OutOfMemoryError.class)
- .isEqualTo(error);
+ for (OutOfMemoryError error : asList(new OutOfMemoryError("Java heap
space"),
+ new OutOfMemoryError("GC overhead
limit exceeded")))
+ {
+ Assertions.assertThatThrownBy(() ->
JVMStabilityInspector.inspectThrowable(error))
+ .isInstanceOf(OutOfMemoryError.class)
+ .isEqualTo(error);
+ }
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]