• Out Of Memory Error

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #41686  by malcmail
 
I've only had the system up and running a few days and as yet only have a handful of small documents on it. I'm also the only user right now. However the system keeps stalling and when I check the terminal it is almost always java OutOfMemory error messages. Often it is from trying to generate a preview. Sometimes uploading a document (never very big). Is there something I need to tweak? My set up is 6GB RAM, Ubuntu Server 14.04 64 bit, Core 2 Chip @ 2.5Ghz with a 1TB drive.
 #41695  by ofstab
 
In short, yes you need to do some tweaking. My notes (Windows Server 2008 64bit) are:
Code: Select all
catalina.bat run
Using CATALINA_BASE:   "G:\xampp\tomcat"
Using CATALINA_HOME:   "G:\xampp\tomcat"
Using CATALINA_TMPDIR: "G:\xampp\tomcat\temp"
Using JRE_HOME:        "C:\Program Files (x86)\Java\jdk1.7.0_79\jre"
Using CLASSPATH:       "G:\xampp\tomcat\bin\bootstrap.jar;G:\xampp\tomcat\bin\tomcat-juli.jar"
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.
In windows, the file to edit is setenv.bat (in the bin folder). There is an equivalent bash script. On first boot the first line will look a bit like this:
set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx2048m -XX:+UseConcMarkSweepGC -Djava.awt.headless=true
Where:
-Xms size in bytes
Sets the initial size of the Java heap.
The default size is 2097152 (2MB).
The values must be a multiple of, and greater than, 1024 bytes (1KB).
(The -server flag increases the default size to 32M.)
-Xmx size in bytes
Sets the maximum size to which the Java heap can grow.
The default size is 64M.
(The -server flag increases the default size to 128M.)
The maximum heap limit is about 2 GB (2048MB).
If the Xmx is set too high then you get the could not reserve enough space error. 2G does not work for me.

The `space for object heap` error is one about memory. The default Xmx setting in the install version of setenv.bat is 2048m. This just does not work for me. Using this does:
Code: Select all
set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx1024m -XX:+UseConcMarkSweepGC -Djava.awt.headless=true
This seems to be a Java 32bit problem. If you switch to Java 64bit then this probably goes away. Later on, you are going to encounter a different memory problem (malcmail - I think this is the one you have) which means adding in support for the PermSize:
-XX:PermSize -XX:MaxPermSize are used to set size for Permanent Generation.
Permanent Generation: The Permanent Generation is where class files are kept. These are the result of compiled classes and jsp pages. If this space is full, it triggers a Full Garbage Collection. If the Full Garbage Collection cannot clean out old unreferenced classes and there is no room left to expand the Permanent Space, an Out of Memory error (OOME) is thrown and the JVM will crash.
Hence:
Code: Select all
set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m -XX:PermSize=512m -XX:MaxPermSize=1g -XX:+UseConcMarkSweepGC -Djava.awt.headless=true
This then interferes with the max heap size, and you will see I have had to cut that to 512m. This is the best I can get on Windows Server 2008 64bit, with 32bit Java and XAMPP. On my current 12Gb Server with 64bit Java, I am trying:
Code: Select all
set JAVA_OPTS=%JAVA_OPTS% -Xms1g -Xmx2g -XX:PermSize=2g -XX:MaxPermSize=4g -XX:+UseConcMarkSweepGC -Djava.awt.headless=true
It is running for now, but needs more testing.
 #41712  by jllort
 
I see in your path C:\Program Files (x86)\Java\jdk1.7.0_79\jre -> seems your are using a 32 bit java version. We suggest 64 bits jdk ( less probless for using more of 2GB otherwise you will get a limit with 32 bits versions ).
 #41723  by malcmail
 
Thanks for the replies (which I've only just spotted!). I'll read through these and see if I can make sense of them for my Linux set up. Cheers guys.
 #43256  by douglas.cunha
 
I also had a problem with OutOfMemoryException happening on a default installation after some big files was uploaded.
After this, I cannot get OpenKM to start anymore.

I tried to switch to 64-bit Java with no success.
Also tried to change the default JAVA_OPTS on setenv.bat, which currently are:

set JAVA_OPTS =-Xms512m-Xmx2048m - XX: PermSize = 128M - XX: MaxPermSize = 512m-Djava.awt.headless=true-Dfile.encoding=utf-8

What can I do to get it to start again? At this point I cannot even get my files.

Thanks.
 #43276  by jllort
 
Your java setting are not well written, missing spaces and extra ones in other places, use one of these and compare with yours:
Code: Select all
set JAVA_OPTS =-Xms512m -Xmx2048m -XX:PermSize=128M -XX:MaxPermSize=512m -Djava.awt.headless=true -Dfile.encoding=utf-8
or
Code: Select all
set JAVA_OPTS =-Xms512m -Xmx2048m -XX:PermSize=128M -XX:MaxPermSize=1024m -Djava.awt.headless=true -Dfile.encoding=utf-8

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.