Java IllegalArgumentException "committed > max memory" when initializing java.lang.management.MemoryUsage
Issue
-
I have an application that collects heap memory usage information using the Java API java.lang.management.MemoryMXBean#getHeapMemoryUsage(). It failed with the following exception indicating that the committed memory exceeds the maximum heap memory. This happened once in our environment. The issue did not happened after we restart JVM:
java.lang.IllegalArgumentException: committed = 2149580800 should be < max = 2147483648 at java.management/java.lang.management.MemoryUsage.<init>(MemoryUsage.java:166) at java.management/sun.management.MemoryImpl.getMemoryUsage0(Native Method) at java.management/sun.management.MemoryImpl.getHeapMemoryUsage(MemoryImpl.java:71) ...(snip)...
-
Messages piling up in the AMQ error queue due to the following exception in my camel application:
Caught java.lang.IllegalArgumentException: committed = 3223322624 should be < max = 3221225472 for 1Z538W6W0497904765: java.lang.IllegalArgumentException: committed = 3223322624 should be < max = 3221225472 at java.lang.management.MemoryUsage.<init>(MemoryUsage.java:160) at sun.management.MemoryImpl.getMemoryUsage0(Native Method) at sun.management.MemoryImpl.getHeapMemoryUsage(MemoryImpl.java:71) at org.apache.camel.impl.DefaultStreamCachingStrategy$UsedHeapMemorySpoolRule.shouldSpoolCache(DefaultStreamCachingStrategy.java:381) ...(snip)...
Environment
- OpenJDK 8, 11
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.