JDK-7112912 : Message "Error occurred during initialization of VM" on boxes with lots of RAM
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs25,6u29
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_redhat_5.0
  • CPU: x86
  • Submitted: 2011-11-17
  • Updated: 2023-09-04
  • Resolved: 2013-03-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 JDK 8 Other
6u115Fixed 7u101Fixed 8 b85Fixed hs25,openjdk7uFixed
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
./bin/java -Xmx256M -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux wn-car-027.farm.nikhef.nl 2.6.18-274.3.1.el5 #1 SMP Tue Sep 6 20:13:52 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

(CentOS 5.7)

EXTRA RELEVANT SYSTEM CONFIGURATION :
Oracle Java 6u29
(same bug applies to OpenJDK 1.6.0)

A DESCRIPTION OF THE PROBLEM :
the latest&greatest worker nodes have 12 cores and 48 GB of RAM ; we
offer a maximum 12 jobs slots on these worker nodes, in order to
accomodate small and large jobs (users can requests 1 - 12 cores). To
ensure that the different jobs don't interfere with each other we also
set a VMEM limit for each job slot. The current VMEM limit is 48 / 12 =
4 GB RAM per job slot. Each single core job that starts has a 'ulimit
-v' of 4,000,000 .

On these boxes java refuses to start:

$ java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

After some debugging I found that this is caused by the default maximum
heap size which java allocates: it scans /proc/meminfo to extrac the
amount of RAM installed and divides it by 4 ; an 'strace' shows that
indeed 'java' tries to do an 'mmap' call for 12 GB of RAM !

A work around is to always specify '-Xmx2GB' or something similar but
this does not work for all software that we use , plus , I find it
annoying that I have to tell this to all my users.

What I would like to see is a system-wide setting for the initial
maximum heap size, so that
  java -version
"just works" . Is this possible?


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- take a box with 8 GB of ram or more
- set
  ulimit -v 1600000
- run
  java -version

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)

ACTUAL -
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
always specify
  -Xmx<number>

this is not always possible , however.

Comments
URL: http://hg.openjdk.java.net/jdk8/jdk8/hotspot/rev/754c24457b20 User: amurillo Date: 2013-04-09 21:34:29 +0000
09-04-2013

Proposed fix: Use maximum virtual memory sizes as reported by the OSes to limit max heap size
11-03-2013

Also affects hs25
06-03-2013

See also JDK-6374896 - as per John's comments it seems like GC ergonomics needs to be accounting for imposed process limits.
06-03-2013

EVALUATION It is not, I believe, the "java -version" that is the issue, that is just a way to demonstrate the problem. The user wants a way to control/set the value of -Xmx on all JVMs launched on a machine. Use of _JAVA_OPTIONS may be of assistance.
18-11-2011

EVALUATION The JVM should check the amount of address space available to the user running the application (getrlimit(RLIMIT_AS) on solaris/linux, not sure of the equivalent on windows), and use that as an additional constraint on the size of the heap requested. On solaris, RLIMIT_VMEM should also be considered.
17-11-2011

EVALUATION It is not clear to me what is being asked. The customer is asking for a system-wide configuration file to set the starting heap size ? to print -version at the least and then what ? But as far as I can tell the the GC reserves the space up front to ensure contiguous memory, due to server VM GC ergonomics. Nevertheless, I am reassigning to the GC team for their evaluation.
17-11-2011