← Back to team overview

openjdk team mailing list archive

[Bug 1241926] Re: Giant Bug: Cannot run java with a virtual mem limit (ulimit -v)

 

Please take this bug serious and report it upstream because whatever is
the technical reason for this Java VM behaviour - it needs to be fixed.

Running a usual remote multi-user x86-64 Linux machine I can confirm
this GIANT bug and provide additional information:

- This bug applies to all Java versions I tested so far (OpenJDK 6-8,
Oracle Java 6-8). The consequences of the bug are excessive and posted
several times on the web without a reasonable reaction (e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=510344) - except telling the
people to provide an artificial memory limit to java directly via -Xmx.

- The bug occurs when the virtual memory limit (ulimit -v) is set below
30% of the total memory available on the system. On large servers the
required minimum memory limit becomes huge(!)

- This bug happens with even the simplest java programs among them are
the execution of "java -version" or the Hello World example from
https://en.wikipedia.org/wiki/Java_%28programming_language%29 .

Example (Server has 48 GB memory):
> ulimit -v 16777216
> java -version
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

> ulimit -v 12000000
> java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

> java -Xmx2m -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
--> java -version should run with 2 MB of virtual memory.

Its amazing! Java can't even allocate 12 GB of RAM in the time it needs
to put out the out of memory error. I am really curious how it finds the
limit so fast to crash. Java can therefore be not executed normally
(without -Xmx) on any machine with a reasonable memory limit for users!
This behaviour leads to many subsequent bugs in java-software (e.g.
eclipse) that I found on the web.

Everyone knows that java is kind of a slow and crappy language but thats
not an argument to allow the Java VM to crash if the Helloworld example
can not reserve 15 GB of memory on a larger server(!) I have no idea how
this bug could survive for that long.

** Bug watch added: Red Hat Bugzilla #510344
   https://bugzilla.redhat.com/show_bug.cgi?id=510344

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1241926

Title:
  Giant Bug: Cannot run java with a virtual mem limit (ulimit -v)

Status in openjdk-7 package in Ubuntu:
  Confirmed

Bug description:
  $ java
  Usage: java [-options] class [args...]
             (to execute a class)
     or  java [-options] -jar jarfile [args...]
             (to execute a jar file)
  [...]
  $ ulimit -v 2097152
  $ java
  #
  # There is insufficient memory for the Java Runtime Environment to continue.
  # pthread_getattr_np
  # An error report file with more information is saved as:
  # /home/moritz/hs_err_pid16051.log

  This is no reason why java should try to allocate more than 2 GB of
  RAM for diplaying a simple help message. If it does need much memory,
  it should inspect existng limits to make sure it doesn't try to
  allocate more than the resource limit.

  It's very inconvenient not to be able to run java just because of
  (very generous) per user ulimits.

  ProblemType: Bug
  DistroRelease: Ubuntu 12.04
  Package: openjdk-7-jre-headless 7u25-2.3.10-1ubuntu0.12.04.2
  ProcVersionSignature: Ubuntu 3.8.0-31.46~precise1-generic 3.8.13.8
  Uname: Linux 3.8.0-31-generic x86_64
  ApportVersion: 2.0.1-0ubuntu17.5
  Architecture: amd64
  Date: Sat Oct 19 07:08:18 2013
  EcryptfsInUse: Yes
  InstallationMedia: Ubuntu 12.04.3 LTS "Precise Pangolin" - Release amd64 (20130820.1)
  MarkForUpload: True
  SourcePackage: openjdk-7
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/1241926/+subscriptions


References