Default memory allocation issue in Alfresco CE 201707 GA (aka 5.2)

cancel
Showing results for 
Search instead for 
Did you mean: 

Default memory allocation issue in Alfresco CE 201707 GA (aka 5.2)

2 2 1,310

Important notice for every Alfresco Community server using default installer

If you are using Alfresco 201707 GA and you used default installer (provided by BitRock), your Tomcat is using only 1 GB for your web applications (alfresco.war, share.war & solr4.war).

How to check if you are affected

When you Alfresco server is up, type following instruction (they can be different depending on your operative system)

$ ps -ef | grep java
501 910 1 0 9:39AM ttys001 3:58.00 /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java
-Djava.util.logging.config.file=/opt/alfresco-community/tomcat/conf/logging.properties
-Xms512M -Xmx8192M -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
-Dalfresco.home=/opt/alfresco-community
-XX:ReservedCodeCacheSize=128m -Xms128m -Xmx1024m -XX:+DisableExplicitGC
-Dcatalina.base=/opt/alfresco-community/tomcat
-Dcatalina.home=/opt/alfresco-community/tomcat
-Djava.io.tmpdir=/opt/alfresco-community/tomcat/temp
org.apache.catalina.startup.Bootstrap start
‍‍‍

Probably you (or the installer) included a Java Memory configuration in the file /opt/alfresco-community/tomcat/bin/setenv.sh (8192M in this sample) but BitRock created a file at /opt/alfresco-community/tomcat/scripts/ctl.sh that is overwriting your configuration to 1024m. This is why two different Xmx and also Xms flags are shown by the ps command. 

How to solve the issue

In order to allow standard Java Memory configuration to be applied from setenv.sh file, script generated by installer have to be modified. Edit /opt/alfresco-community/tomcat/scripts/ctl.sh to replace this line...

export JAVA_OPTS="-Xms128m -Xmx1024m -XX:+DisableExplicitGC -Djava.awt.headless=true -Dalfresco.home=/opt/alfresco-community -Dcom.sun.management.jmxremote -Dsun.security.ssl.allowUnsafeRenegotiation=true -XX:ReservedCodeCacheSize=128m"

... with following content

export JAVA_OPTS="-Djava.awt.headless=true -Dalfresco.home=/opt/alfresco-community -Dcom.sun.management.jmxremote -Dsun.security.ssl.allowUnsafeRenegotiation=true -XX:ReservedCodeCacheSize=128m"

Re-start Alfresco and you'll see only one Xmx and Xms flag associated to your Java process Id.

$ ps -ef | grep java
501 910 1 0 9:39AM ttys001 3:58.00 /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java
-Djava.util.logging.config.file=/opt/alfresco-community/tomcat/conf/logging.properties
-Xms512M -Xmx8192M -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
-Dalfresco.home=/opt/alfresco-community
-Dcatalina.base=/opt/alfresco-community/tomcat
-Dcatalina.home=/opt/alfresco-community/tomcat
-Djava.io.tmpdir=/opt/alfresco-community/tomcat/temp
org.apache.catalina.startup.Bootstrap start

Final recap

This issue was introduced by BitRock installer and it's not intended to limit Alfresco Community resources.

Alfresco will not patch it, as installer has been discontinued for Alfresco 6.0. 

About the Author
Angel Borroy was technical lead architect at keensoft. Over the last 15 years, he has been working as a software architect on Java, BPM, document management and electronic signatures. He has been working with Alfresco during the last years to customize several implementations in large organizations and to provide add-ons to the Community based on Record Management and Electronic Signature. He writes (sometimes) on his personal blog http://angelborroy.wordpress.com. He is (proud) member of the Order of the Bee. Angel Borroy is Engineer at Alfresco.
2 Comments
yreg
Active Member II

It seems not only Community Edition is affected, I found out that the latest SP from Alfresco 5.2 has it as well !

root      82268  3.0 15.9 3920132 1303704 ?     Sl   Apr25  28:07 /opt/alfresco-content-services/java/bin/java -Djava.util.logging.config.file=/opt/alfresco-content-services/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms512M -Xmx3983M -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Djava.awt.headless=true -Dalfresco.home=/opt/alfresco-content-services -XX:ReservedCodeCacheSize=128m -Xms128m -Xmx1024m -XX:+DisableExplicitGC -Djava.awt.headless=true -Dalfresco.home=/opt/alfresco-content-services -Dcom.sun.management.jmxremote -Dsun.security.ssl.allowUnsafeRenegotiation=true -XX:ReservedCodeCacheSize=128m -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/opt/alfresco-content-services/tomcat/endorsed -classpath /opt/alfresco-content-services/tomcat/bin/bootstrap.jar:/opt/alfresco-content-services/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/alfresco-content-services/tomcat -Dcatalina.home=/opt/alfresco-content-services/tomcat -Djava.io.tmpdir=/opt/alfresco-content-services/tomcat/temp org.apache.catalina.startup.Bootstrap start
cesarista
Advanced

Hi:

I have seen this problem intermittently in several Alfresco 5.x versions. And yes, this happens with the installer of last Alfresco 5.2.3, where JAVA_OPTS are set both in ctl.sh and setenv.sh scripts.

Regards.

--C.