The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Java memory problem

Discussion in 'General Discussion' started by jcorreia, Feb 25, 2010.

  1. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    HI,
    I´m running in my dedicated server a xmpp java server - openfire.
    Yesterday I´ve upgraded from cpanel 11.23 to the last stable 11.25. Openfire was running smootly in my server(with 2G of RAM) for 3 years,
    but yesterday when I tried to reboot I´ve come across an error stating

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

    I was trying to run it as root, so I think it´s not user permissions or limits.
    I´ve managed to start it changing in /etc/sysconfig/openfire

    to OPENFIRE_OPTS="-Xmx64m"

    Normally it was OPENFIRE_OPTS="-Xms32m -Xmx192m".

    After a server restart I´ve managed to do an openfire restart with the memory it was always configured (192m).

    It´s the first time I´ve come across this error, so I supposed it´s in some way related to the cpanel upgrade.

    After some research I´ve found that it could be related to fork bomb in WHM, but I always had it turned off.

    I´ve read in another forums(from people that have problems with tomcat anf other java servers) that a possible solution to this in cpanel
    is to add the following code in the start of the /etc/profile file.

    PHP:
    #cPanel Added Limit Protections -- BEGIN

    #unlimit so we can run the whoami
    ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null

    LIMITUSER
    =$USER
    if [ -"/usr/bin/whoami" ]; then
    LIMITUSER
    =`/usr/bin/whoami`
    fi
    if [ "$LIMITUSER!= "root" ]; then
    ulimit 
    -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
    else
    ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    fi
    #cPanel Added Limit Protections -- END
    from here Could not reserve enough space for object heap - UK Web Hosting | Dedicated Server and VPS Forum

    But there some other solutions here
    NGASI Installation and Administration


    My question is ? did something changed from 11.23 to 11.25 that could introduce java server problems ?
    Do you advice that solution in etc/profile ? Is there another better solution ?


    Thanks,
    Jorge Correia
     
    #1 jcorreia, Feb 25, 2010
    Last edited: Feb 26, 2010
  2. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
  3. qwidjib0

    qwidjib0 Member
    PartnerNOC

    Joined:
    Aug 3, 2005
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago, Illinois
    Memory issues with the JVM are incredibly common in Java hosting. Some things you might consider throwing into /var/cpanel/tomcat.options

    Word of caution when doing this, however- if you give memory resources to the JVM, they will be taken away from the rest of the server; so don't set them too high.
     
Loading...

Share This Page