Reputation: 1002
The team switched from Oracle JRE 1.8 to OpenJDK. Started the test with this version:
java-1.8.0-openjdk-1.8-Ø.372
Things were OK until load testing started and moved to a higher staging environment. The team started getting the following errors:
Cannot start the application with -Xmx1024m:
Error occurred during initialization of VM
Could not reserve enough space for 1048576KB object heap
Then, change the JVM memory parameter to -Xmx512m (or kill some unwanted background services/tasks on Windows Server), the application will start successfully and then start throwing the following errors halfway through load testing:
java.lang.OutOfMemoryError: Java heap space
There is the following restriction: must use JRE 32-bit version 1.8.0_341 or lower since the JDK used was based on 1.7. The 32-bit is due to using other components that don't work with 64-bit.
I have done extensive research, and came across various articles including this one:
Difference between JVM and HotSpot?
Note that the application has been working for years, without any error, with Oracle's JRE 1.8 update 341.
I have the following troubleshooting plan:
OpenJ9: https://developer.ibm.com/languages/java/semeru-runtimes/downloads/
HotSpot: https://adoptium.net/temurin/releases/?version=8
Try a lower or higher version of OpenJDK since there is no one-to-one mapping between the Oracle JRE version and that of OpenJDK.
Try other GC Algorithms based on this article:
https://developers.redhat.com/articles/2021/11/02/how-choose-best-java-garbage-collector
I need your help to find other troubleshooting options, and in particular, how to use Java tools to start profiling and memory debugging to see what is going wrong.
In the following, I will provide info about the OpenJDK and other details.
java -version -XshowSettings:properties
I get the following:openjdk version "1.8.0_372"
OpenJDK Runtime Environment (build 1.8.0_372-b07)
OpenJDK Server VM (build 25.372-b07, mixed mode)
Property settings:
awt.toolkit = sun.awt.windows.WToolkit
file.encoding = Cp1252
file.encoding.pkg = sun.io
file.separator = \
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\endorsed
java.ext.dirs = C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\ext
C:\Windows\Sun\Java\lib\ext
java.home = C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre
java.runtime.name = OpenJDK Runtime Environment
java.runtime.version = 1.8.0_372-b07
java.specification.maintenance.version = 4
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Red Hat, Inc.
java.vendor.url = https://developers.redhat.com/
java.vendor.url.bug = https://bugzilla.redhat.com/enter_bug.cgi
java.version = 1.8.0_372
java.vm.info = mixed mode
java.vm.name = OpenJDK Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Red Hat, Inc.
java.vm.version = 25.372-b07
line.separator = \r \n
os.arch = x86
os.name = Windows Server 2019
os.version = 10.0
path.separator = ;
sun.arch.data.model = 32
sun.boot.class.path = C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\resources.jar
C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\rt.jar
C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\sunrsasign.jar
C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\jsse.jar
C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\jce.jar
C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\charsets.jar
C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\lib\jfr.jar
C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\classes
sun.boot.library.path = C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\bin
sun.cpu.endian = little
sun.cpu.isalist = pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
sun.desktop = windows
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = Cp1252
sun.management.compiler = HotSpot Tiered Compilers
sun.os.patch.level =
sun.stderr.encoding = cp437
sun.stdout.encoding = cp437
user.country = US
user.dir = C:\Program Files (x86)\RedHat\java-1.8.0-openjdk-1.8.0.372-1\bin
user.language = en
user.script =
user.timezone =
user.variant =
Does this mean that I am using HotSpot OpenJDK?
Processor: Intel(R) Xeon(R) Platinum CPU @ 2.20GHz 2.19 GHz (16 processors)
Installed memory (RAM): 64.0 GB
System type: 64-bit Operating System, x64-based processor
Pen and Touch: Pen and Touch Support with 10 Touch Points
I installed VisualVM and watched a couple of tutorials. I think I have a plan. I will get a dump of the JVM parameters, use profiling/sampling/snapshots/heap dump, and then compare the differences between OpenJDK and Oracle JDK. I will also use to option to create a heap dump when the OutOfMemeory exception is thrown.
Any Idea how to use VisualVM effectively to find a resolution for this issue?
Upvotes: 0
Views: 986
Reputation: 35
There is space limitation for 32-bit process. Each process can use up to 2GB. (Refer another SO Answer)
You can use OpenJ9 JVM from IBM (still IBM support 32bit version for Java 8) which can significantly reduce overall memory footprint and you can start your application. JDK Link
Upvotes: 1