OpenVZ Forum



Members   Search      Help    Register    Login    Home
Home » General » Support » *SOLVED* Java: Could not reserve enough space for object heap
*SOLVED* Java: Could not reserve enough space for object heap [message #7057] Mon, 02 October 2006 12:01 Go to next message
hm2k is currently offline hm2k
Messages: 24
Registered: August 2006
Location: UK
Junior Member
From: 82.152.138*
I am running CentOS on the hardware node with OpenVZ, running a Fedora VPS.

I am trying to run software that uses Java, and I keep getting the following error:

Quote:

-bash-3.00# /usr/java/jre1.5.0_06/bin/java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


How can I fix this?

Thanks.

[Updated on: Wed, 04 October 2006 02:04] by Moderator

Report message to a moderator

Re: Java: Could not reserve enough space for object heap [message #7058 is a reply to message #7057] Mon, 02 October 2006 12:05 Go to previous messageGo to next message
dim is currently offline dim
Messages: 342
Registered: August 2005
Senior Member
From: *sw.ru
Check this article, probably it helps:
http://wiki.openvz.org/Resource_shortage


http://static.openvz.org/openvz_userbar_en.gif
Re: Java: Could not reserve enough space for object heap [message #7060 is a reply to message #7058] Mon, 02 October 2006 12:13 Go to previous messageGo to next message
hm2k is currently offline hm2k
Messages: 24
Registered: August 2006
Location: UK
Junior Member
From: 82.152.138*
Thanks, but I am already aware of this and am looking for more specific information.

As you can see below, this VPS has not yet reached its limits.

Quote:

-bash-3.00# cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
102: kmemsize 3573946 4756589 4752512 4936012 67
lockedpages 0 0 32 32 0
privvmpages 94869 133646 491520 535750 0
shmpages 91 1099 28192 28192 0
dummy 0 0 0 0 0
numproc 114 122 265 265 0
physpages 56692 80856 0 2147483647 0
vmguarpages 0 0 26144 2147483647 0
oomguarpages 56693 80857 996144 2147483647 0
numtcpsock 24 55 280 280 0
numflock 4 20 100 100 0
numpty 1 2 16 16 0
numsiginfo 0 11 256 256 0
tcpsndbuf 0 318604 319488 524288 15
tcprcvbuf 0 191608 319488 524288 0
othersockbuf 26300 131940 132096 336896 3117
dgramrcvbuf 0 32524 132096 132096 0
numothersock 22 49 280 280 0
dcachesize 284917 385941 2048576 2097728 0
numfile 1059 1485 2048 2048 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 43 43 256 256 0



If I have clearly missed something please let me know, otherwise please provide me with more specific information.

Thanks.
Re: Java: Could not reserve enough space for object heap [message #7061 is a reply to message #7060] Mon, 02 October 2006 12:40 Go to previous messageGo to next message
dim is currently offline dim
Messages: 342
Registered: August 2005
Senior Member
From: *sw.ru
Quote:

-bash-3.00# cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
102: kmemsize 3573946 4756589 4752512 4936012 67



failcnt = 67


http://static.openvz.org/openvz_userbar_en.gif
Re: Java: Could not reserve enough space for object heap [message #7063 is a reply to message #7061] Mon, 02 October 2006 15:32 Go to previous messageGo to next message
hm2k is currently offline hm2k
Messages: 24
Registered: August 2006
Location: UK
Junior Member
From: 82.152.138*
My mistake, that was the wrong VPS...

-bash-3.00# cat /proc/user_beancounters
Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
       104: kmemsize        3943800    4160542    9753527    9752512          0
            lockedpages           0          0         32         32          0
            privvmpages       23222      38193      69152      73575          2
            shmpages           2441       3417       8192       8192          0
            dummy                 0          0          0          0          0
            numproc              53         58        256        256          0
            physpages         14000      16202          0 2147483647          0
            vmguarpages           0          0       6144 2147483647          0
            oomguarpages      14004      16202       6144 2147483647          0
            numtcpsock            8         12         80         80          0
            numflock              4         10        100        110          0
            numpty                1          1         16         16          0
            numsiginfo            0          3        256        256          0
            tcpsndbuf             0      24508     319488     524288          0
            tcprcvbuf             0      10116     319488     524288          0
            othersockbuf      22280      27124     132096     336896          0
            dgramrcvbuf           0       2228     132096     132096          0
            numothersock         15         21         80         80          0
            dcachesize       237062     270354    1048576    1097728          0
            numfile            3239       3501       4086       4086          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent            10         10        128        128          0
Re: Java: Could not reserve enough space for object heap [message #7064 is a reply to message #7057] Mon, 02 October 2006 15:50 Go to previous messageGo to next message
jacobwm is currently offline jacobwm
Messages: 8
Registered: June 2006
Junior Member
From: *jwmcnutt.com
This is most likely due to the fact that java requires contiguous blocks of memory when it starts up at least equal to your memory settings in java.

It's difficult to guarantee there are large enough contiguous blocks available in a VPS.

I found that out with an app we run that requires 2GB+ of RAM ... our solution was to move to 64-bit OS and buy lots of RAM. Contiguous block errors aren't eliminated but they are certianly reduced.
Re: Java: Could not reserve enough space for object heap [message #7067 is a reply to message #7064] Mon, 02 October 2006 16:52 Go to previous messageGo to next message
hm2k is currently offline hm2k
Messages: 24
Registered: August 2006
Location: UK
Junior Member
From: 82.152.138*
Or it could be that privvmpages is hitting its limits.
Re: Java: Could not reserve enough space for object heap [message #7068 is a reply to message #7064] Mon, 02 October 2006 17:13 Go to previous messageGo to next message
frankfischer is currently offline frankfischer
Messages: 7
Registered: March 2006
Location: Germany
Junior Member
From: *dip0.t-ipconnect.de
I really don't belive that there is a problem with the contiguous memory blocks - I'm running openVz on serveral different hardware nodes using centOS 4.[3|4] (vps and host OS) 32-bit. These VPS run resource intensive java-apps like zimbra, alfresco, JBoss Portal and so on without any problems. Serveral smaller tomcat apps are running on theses servers, too. No problems since more than eight months.
Ensure that your memory setting of the VM correspondent with the memory settings of the VPS and remeber that the OS itself needs some memory.

Regards,

Frank
Re: Java: Could not reserve enough space for object heap [message #7070 is a reply to message #7057] Mon, 02 October 2006 23:24 Go to previous messageGo to next message
ckpeter is currently offline ckpeter
Messages: 8
Registered: October 2006
Junior Member
From: *hsd1.il.comcast.net
I have had this problem in the past. The reason why Java complains is because on start up, it sees that the machine has more than 2 GB of RAM, so it starts up in server mode, which tries to allocate all the memory, which then fails because it is inside a VPS.

You can manually specify -Xmx256m on the command line every time you start Java to avoid Java trying to allocate all the memory.

If you want something more seamless, go under the /usr/java/jdk/jre/lib/i386, delete server, and symlink server to client. This is a sneaky way of changing the server VM to the client VM, but it works very well (as long as you don't need the server VM).
Re: Java: Could not reserve enough space for object heap [message #7088 is a reply to message #7061] Tue, 03 October 2006 09:06 Go to previous messageGo to next message
hm2k is currently offline hm2k
Messages: 24
Registered: August 2006
Location: UK
Junior Member
From: 82.152.138*
-bash-3.00# /usr/java/jre1.5.0_06/bin/java -version -Xmx256m
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


Still not working...

resource           held    maxheld    barrier      limit    failcnt
privvmpages       23499      38193      69152      73575          6


The held and failcnt has increased since I have run it a couple of times since, however nothing else has changed, no limits or barriers appear to have been reached, even though the failcnt has increased.

What could be the problem?
Re: Java: Could not reserve enough space for object heap [message #7089 is a reply to message #7088] Tue, 03 October 2006 09:12 Go to previous messageGo to next message
Vasily Tarasov is currently offline Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
From: *sw.ru
Quote:

The held and failcnt has increased since I have run it a couple of times since, however nothing else has changed, no limits or barriers appear to have been reached, even though the failcnt has increased.


You should set barrier/limit so high, that no failcounters will appear! Just try to increase barrier/limit to extremely big value, run java, than mark maxheld. And set barrier/limit for example to (maxheld + 0.25 * maxheld).
Re: Java: Could not reserve enough space for object heap [message #7092 is a reply to message #7088] Tue, 03 October 2006 11:14 Go to previous messageGo to next message
ckpeter is currently offline ckpeter
Messages: 8
Registered: October 2006
Junior Member
From: *hsd1.il.comcast.net
hm2k wrote on Tue, 03 October 2006 08:06

-bash-3.00# /usr/java/jre1.5.0_06/bin/java -version -Xmx256m
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


Still not working...

resource           held    maxheld    barrier      limit    failcnt
privvmpages       23499      38193      69152      73575          6


The held and failcnt has increased since I have run it a couple of times since, however nothing else has changed, no limits or barriers appear to have been reached, even though the failcnt has increased.

What could be the problem?


It looks like your total limit is about 256 MB for the VPS. Did you try lower value of -Xmx? Try -Xmx32m. Remember too that the value specified is only for the Java heap (the actual JVM memory usage will be higher), so you can't just specify a value that is at the limit of your VPS's memory allocation.

[Updated on: Tue, 03 October 2006 11:19]

Report message to a moderator

Re: Java: Could not reserve enough space for object heap [message #7093 is a reply to message #7092] Tue, 03 October 2006 11:37 Go to previous messageGo to next message
hm2k is currently offline hm2k
Messages: 24
Registered: August 2006
Location: UK
Junior Member
From: 82.152.138*
 privvmpages       23499     297144     369152     373575          7


It works now I increased the privvmpages.

-bash-3.00# /usr/java/jre1.5.0_06/bin/java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)
Re: Java: Could not reserve enough space for object heap [message #16165 is a reply to message #7093] Sun, 26 August 2007 07:28 Go to previous messageGo to next message
tischercd is currently offline tischercd
Messages: 2
Registered: August 2007
Junior Member
From: *pvoce702.dsl.brasiltelecom.net.br
Hi

I am the same problem and java not work

[root@server bin]# ./java -version -Xmx32m
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

# cat /proc/user_beancounters
resource held maxheld barrier limit failcnt
privvmpages 88170 88214 131072 139264 514635127

I am runing vps in centos 4.5 on 64-bit amd.

Any solution
Re: Java: Could not reserve enough space for object heap [message #16179 is a reply to message #16165] Sun, 26 August 2007 20:20 Go to previous messageGo to next message
locutius is currently offline locutius
Messages: 125
Registered: August 2007
Senior Member
From: *bb.sky.com

-bash-3.00# cat /proc/user_beancounters
Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
       104: kmemsize        3943800    4160542    9753527    9752512          0
            lockedpages           0          0         32         32          0
            privvmpages       23222      38193      69152      73575          2
            shmpages           2441       3417       8192       8192          0
            dummy                 0          0          0          0          0
            numproc              53         58        256        256          0
            physpages         14000      16202          0 2147483647          0
            vmguarpages           0          0       6144 2147483647          0
            oomguarpages      14004      16202       6144 2147483647          0
            numtcpsock            8         12         80         80          0
            numflock              4         10        100        110          0
            numpty                1          1         16         16          0
            numsiginfo            0          3        256        256          0
            tcpsndbuf             0      24508     319488     524288          0
            tcprcvbuf             0      10116     319488     524288          0
            othersockbuf      22280      27124     132096     336896          0
            dgramrcvbuf           0       2228     132096     132096          0
            numothersock         15         21         80         80          0
            dcachesize       237062     270354    1048576    1097728          0
            numfile            3239       3501       4086       4086          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent            10         10        128        128          0



privvmpages is the amount of memory than can be allocated by processes, it does not account memory use

vmguarpages is the memory guaranteed for use, and it is woefully low at 6144 (looks like the default config for pong)

oomguarpages is accounting the actual memory use and you can see it far exceeds vmguarpages

guys plz read up in the wiki on /proc/user_beancounters

AND WARNING! dont take the default config and try to adjust it up for a Java machine because there is zero match to your hardware. use vzsplit 8 or 16 or more ways to discover your hardware capabilities

[Updated on: Sun, 26 August 2007 20:21]

Report message to a moderator

Re: Java: Could not reserve enough space for object heap [message #28116 is a reply to message #16179] Sun, 09 March 2008 15:49 Go to previous message
ttest is currently offline ttest
Messages: 1
Registered: March 2008
Junior Member
From: *dynamic.mnet-online.de
There's a more elegant way to modify the default VM type that's used on Linux. This can be set in /etc/java-1.5.0-sun/jvm.cfg

Mine now looks like:
#-client IF_SERVER_CLASS -server
-client KNOWN
-server KNOWN
-hotspot ALIASED_TO -client
-classic WARN
-native ERROR
-green ERROR

Greets

Christian
Previous Topic:VPS for Oracle, requires SWAP partition
Next Topic:latest Gentoo template
Goto Forum:
  


Current Time: Wed Aug 20 22:20:43 EDT 2014
Powered by FUDforum Powered by Parallels Virtuozzo Containers