You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/11/11 18:21:15 UTC

[GitHub] [cassandra] yifan-c commented on a change in pull request #761: CASSANDRA-15214: Force throw heap space OutOfMemory error

yifan-c commented on a change in pull request #761:
URL: https://github.com/apache/cassandra/pull/761#discussion_r521552554



##########
File path: src/java/org/apache/cassandra/utils/JVMStabilityInspector.java
##########
@@ -125,7 +123,31 @@ public static void inspectThrowable(Throwable t, boolean propagateOutOfMemory, C
             killer.killCurrentJVM(t);
 
         if (t.getCause() != null)
-            inspectThrowable(t.getCause(), propagateOutOfMemory, fn);
+            inspectThrowable(t.getCause(), fn);
+    }
+
+    /**
+     * Intentionally produce a heap space OOM upon seeing a Direct buffer memory OOM.
+     * Direct buffer OOM cannot trigger JVM OOM error related options,
+     * e.g. OnOutOfMemoryError, HeapDumpOnOutOfMemoryError, etc.
+     * See CASSANDRA-15214 for more details
+     */
+    @Exclude // Exclude from just in time compilation.
+    private static void forceHeapSpaceOomMaybe(OutOfMemoryError oom)
+    {
+        // See the oom thrown from java.nio.Bits.reserveMemory.
+        if (!"Direct buffer memory".equals(oom.getMessage()))

Review comment:
       Agree. It is a hacky approach.
   The message remains the same for jdk 11 and below. 
   But the error message has changed since jdk 13. [[1]](https://github.com/openjdk/jdk13u/blob/a0651dd95b40c41803c938781f810aa40c43737b/src/java.base/share/classes/java/nio/Bits.java#L175), [[2]](https://github.com/openjdk/jdk15u/blob/ac465695d5924dc2a634d660c60f2d54d3d2743d/src/java.base/share/classes/java/nio/Bits.java#L175)
   
   I think we can improve it by checking the stack trace that the OOM is thrown from `java.nio.Bits. reserveMemory`. It is more future proofing (valid through jdk15 at least). But still a hack though. 
   WDYT?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org