Jira fails to start if any newlines present in CATALINA_OPTS and/or JAVA_OPTS

Still need help?

The Atlassian Community is here for you.

Ask the community


Problem

Jira fails to start if a newline is used in CATALINA_OPTS and/or JAVA_OPTS. It happens in Jira 8.9 which has been shipped with Tomcat 8.5.50. 

Please see:  JRASERVER-70487 - Getting issue details... STATUS

A setting like below will cause Jira to fail to start:

JVM_SUPPORT_RECOMMENDED_ARGS="
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/data/heapdumps/
...
..."

Diagnosis

Environment

  • Jira 8.9 with Tomcat 8.5.50

Diagnostic Steps

Check the customizations in setenv.sh or setenv.bat file done by setting parameters in JVM_SUPPORT_RECOMMENDED_ARGS, JVM_GC_ARGS, or other variables.

Cause

Expansion of JAVA_OPTS in catalina.sh containing '*' stops startup on the Linux server. This problem is filed under https://bz.apache.org/bugzilla/show_bug.cgi?id=63815 and it's fixed in Tomcat 8.5.48. This bug does not allow newlines in CATALINA_OPTS and/or JAVA_OPTS.

Part of the fix is to stop the expansion by simply put the use of JAVA_OPTS in double-quotes. i.e. "$JAVA_OPTS". You can see the details in catalina.sh below:

# CATALINA_OPTS and/or JAVA_OPTS require quoting. See:
exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \
eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \
eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \
eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \
eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \
eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \

You can find more details in Tomcat 8.5 Change Log: https://tomcat.apache.org/tomcat-8.5-doc/changelog.html

Resolution

Remove newlines and set your customizations in one line:

JVM_SUPPORT_RECOMMENDED_ARGS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heapdumps/......"



Last modified on Nov 23, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.