Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 405239

Summary: emerge dev-java/sun-jdk-1.6.0.31 with 16GB RAM - Could not reserve enough space for object heap
Product: Gentoo Linux Reporter: Norman Back <gentoo3>
Component: [OLD] JavaAssignee: Java team <java>
Status: RESOLVED FIXED    
Severity: normal Keywords: PATCH
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
build.log
Proposed patch
Proposed patch as diff

Description Norman Back 2012-02-22 08:35:28 UTC
dev-java/sun-jdk-1.6.0.31 fails to emerge on x86 with large memory (16GB RAM).
See build log.

Reproducible: Always

Steps to Reproduce:
1. Select an x86 box with large memory (16GB RAM)
2. emerge =dev-java/sun-jdk-1.6.0.31


Actual Results:  
emerge fails:
* ERROR: dev-java/sun-jdk-1.6.0.31 failed (compile phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  85:  Called src_compile
 *   environment, line 2538:  Called die
 * The specific snippet of code:
 *       bin/java -server -Xshare:dump || die


Expected Results:  
1. Select an x86 box with large memory (16GB RAM)
2. emerge =dev-java/sun-jdk-1.6.0.31
3. emerge fails:

editing the ebuild and replacing the line:
/bin/java -server -Xshare:dump || die
with
/bin/java -Xms64m -Xmx64m -server -Xshare:dump || die

Fixes the issue.

This issue also applies to dev-java/sun-jdk-1.6.0.29
Comment 1 Norman Back 2012-02-22 08:37:20 UTC
Created attachment 302785 [details]
emerge --info
Comment 2 Norman Back 2012-02-22 08:50:20 UTC
Created attachment 302787 [details]
build.log
Comment 3 Norman Back 2012-02-22 08:53:21 UTC
Created attachment 302789 [details]
Proposed patch
Comment 4 Norman Back 2012-02-22 08:55:36 UTC
Comment on attachment 302789 [details]
Proposed patch

--- /usr/portage/dev-java/sun-jdk/sun-jdk-1.6.0.31.ebuild       2012-02-22 08:52:12.829538211 +0000
+++ /tmp/sun-jdk-1.6.0.31.ebuild        2012-02-22 08:51:55.261810138 +0000
@@ -107,7 +107,7 @@
        if use x86; then
                bin/java -client -Xshare:dump || die
        fi
-       bin/java -server -Xshare:dump || die
+       bin/java -Xms64m -Xmx64m -server -Xshare:dump || die
 }
 
 src_install() {
Comment 5 Norman Back 2012-02-22 08:56:27 UTC
Created attachment 302791 [details]
Proposed patch as diff
Comment 6 Norman Back 2012-02-22 08:58:27 UTC
This is a specific instance of bug #316121
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2012-02-22 15:59:09 UTC

*** This bug has been marked as a duplicate of bug 316121 ***
Comment 8 Norman Back 2012-02-22 19:05:26 UTC
Please explain how bug 316121 enables me to emerge dev-java/sun-jdk-1.6.0.31 without modifying the ebuild.
Comment 9 Norman Back 2012-02-23 23:03:13 UTC
This bug is not resolved by bug 316121.
Comment 10 Myk Taylor 2012-02-26 00:20:27 UTC
I am in the same situation (16GB RAM on a 32-bit machine).  Adding -Xmx512m to the -server -Xshare:dump line works for me.  Interestingly, -Xmx1024m did not work.
Comment 11 Norman Back 2012-02-26 09:00:57 UTC
(In reply to comment #10)
> I am in the same situation (16GB RAM on a 32-bit machine).  Adding -Xmx512m to
> the -server -Xshare:dump line works for me.  Interestingly, -Xmx1024m did not
> work.

The additional parameters are required to restrict the memory usage, rather than increase it.
Comment 12 Ralph Sennhauser (RETIRED) gentoo-dev 2012-02-27 11:53:21 UTC
(In reply to comment #10)
> I am in the same situation (16GB RAM on a 32-bit machine).  Adding -Xmx512m to
> the -server -Xshare:dump line works for me.  Interestingly, -Xmx1024m did not
> work.

1GB or 1/4 of available ram, whichever is lower, is the default max for server vm and should work for x86. (Practical maximum is <2GB)

-Xmx1024m not working means something is rather odd, may I ask if you can reproduce this issue outside of the ebuild?
Comment 13 Norman Back 2012-02-27 23:17:01 UTC
(In reply to comment #12)
> (In reply to comment #10)
> > I am in the same situation (16GB RAM on a 32-bit machine).  Adding -Xmx512m to
> > the -server -Xshare:dump line works for me.  Interestingly, -Xmx1024m did not
> > work.
> 
> 1GB or 1/4 of available ram, whichever is lower, is the default max for server
> vm and should work for x86. (Practical maximum is <2GB)
> 
> -Xmx1024m not working means something is rather odd, may I ask if you can
> reproduce this issue outside of the ebuild?

# java -server -Xshare:dump
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
# java -server -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) Server VM (build 20.6-b01, mixed mode)
#
Comment 14 Ralph Sennhauser (RETIRED) gentoo-dev 2012-05-05 10:33:16 UTC
I was waiting for related bugs to pop up, doesn't seem to happen and so the issue seems to be limited to generating the CDS.

Committed the workaround. Thanks for the report.