From 3f5f4beee7ec13c13d1f8528999ce18db53a949e Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Wed, 17 Jun 2015 16:33:29 -0400 Subject: [PATCH] Use proper setenv.sh format for v3.8+. [#84] Ref: https://confluence.atlassian.com/display/STASHKB/Stash+crashes+due+to+java.lang.OutOfMemoryError+PermGen+Space+Error --- templates/default/setenv.sh.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/default/setenv.sh.erb b/templates/default/setenv.sh.erb index cc54c97..3aedfff 100644 --- a/templates/default/setenv.sh.erb +++ b/templates/default/setenv.sh.erb @@ -89,6 +89,7 @@ JAVA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} ${JAVA_OPTS} ${JV # PermGen size needs to be increased if encountering OutOfMemoryError: PermGen problems. Specifying PermGen size is # not valid on IBM JDKs STASH_MAX_PERM_SIZE="<%= node['stash']['jvm']['maximum_permgen'] %>" +<% if Gem::Version.new(node['stash']['version']) < Gem::Version.new('3.8') -%> if [ -f "${PRGDIR}/permgen.sh" ]; then echo "Detecting JVM PermGen support..." . "${PRGDIR}/permgen.sh" @@ -99,6 +100,9 @@ if [ -f "${PRGDIR}/permgen.sh" ]; then echo "PermGen switch is NOT supported and will NOT be set automatically." fi fi +<% else -%> +JAVA_OPTS="-XX:MaxPermSize=${STASH_MAX_PERM_SIZE} ${JAVA_OPTS}" +<% end -%> export JAVA_OPTS