Bug #44740 JAVA_OPTS values are overwritten by monitor upgrade installer
Submitted: 8 May 2009 7:35 Modified: 25 Jun 2009 15:22
Reporter: Roger David Nay Email Updates:
Status: Closed Impact on me:
Category:MySQL Enterprise Monitor: Installing Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: BitRock Merlin CPU Architecture:Any

[8 May 2009 7:35] Roger David Nay
JAVA_OPTS configuration changes in the catalina.sh file, like the -Xmx -Xms, etc... are overwritten when the upgrade installer is run. These values are used for customizing larger installations.

How to repeat:
Install mysqlmonitor- and change some values in the catalina.sh file. Upgrade using mysqlmonitor-

From the bitrock installer log:
Unpacking /opt/mysql/enterprise/monitor/apache-tomcat/lib/catalina-ha.jar
Unpacking /opt/mysql/enterprise/monitor/apache-tomcat/bin/catalina-tasks.xml
Unpacking /opt/mysql/enterprise/monitor/apache-tomcat/bin/catalina.bat
Unpacking /opt/mysql/enterprise/monitor/apache-tomcat/bin/catalina.sh

Suggested fix:
Provide functionality to retain the changes made or provide warnings if the file (and other files?) has been modified to enable the administrator to intervene. Don't overwrite the file, and save a copy of the file if it has changed when being overwritten, so changes that have been made aren't lost.
[11 May 2009 19:22] Andy Bang
Easiest way is to break JAVA_OPTS out into a separate file that is not overwritten on upgrade.
[11 May 2009 21:36] Andy Bang
Extract the JAVA_OPTS out to a separate file that gets called when you run catalina.sh/catalina.bat/service.bat.  Create this separate file when using the full installer, but use the one that's already there when running the upgrade installer.  If there's no file already there (e.g. upgrading from 2.0, where the file never existed before, to 2.1), then create the file when doing an upgrade.
[15 May 2009 15:20] BitRock Merlin
Patch sent to Keith. Now JAVA_OPTS are specified in apache-tomcat/bin/setenv.sh (or setenv.bat) file.
[18 May 2009 19:24] Keith Russell
Patch installed in versions =>
[20 May 2009 0:35] Marcos Palacios
Tested using build

Used the monitor upgrade installer to upgrade from bld on Mac OS X, where JAVA_OPTS had the value:

JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$CATALINA_BASE/tmp
-Xmx768M -Xms768M -Xss128k -XX:+UseParallelOldGC -server \
 -Djava.ext.dirs=`$_RUNJAVA -cp $CATALINA_BASE/webapps/ROOT/WEB-INF/lib/merlin.jar
com.mysql.util.SanitizeJreExtPath`"  # Force OSX to use custom libs instead of extension

After the upgrade, the value stored in setenv.sh was:

JAVA_OPTS="-Xmx768M -Xms768M -Xss128k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Applications/mysql/enterprise/monitor/apache-tomcat/tmp -XX:+UseParallelOldGC"

And the value set in catalina.sh was:

JAVA_OPTS="$JAVA_OPTS -server -Djava.ext.dirs=\"$CATALINA_BASE/tmp\""  # Force OSX to use custom libs instead of extension libs.
[20 May 2009 10:08] BitRock Merlin
Regarding Andy previous comment, the 2.1 upgrade installer will write the "setenv.sh/bat" file using the default options if this file does not exist previously. In other words, the upgrade installer will maintain the JAVA_OPTS if the "setenv.sh/bat" file exists previously, so if you are upgrading from a previous version of 2.1.1043 the upgrade installer will not maintain the custom JAVA_OPTS.

On the other hand, catalina.sh file has been updated recently to include the "-Djava.ext.dirs=`$_RUNJAVA -cp $CATALINA_BASE/webapps/ROOT/WEB-INF/lib/merlin.jar com.mysql.util.SanitizeJreExtPath`" option and it was sent to Keith the 19th of May.
[21 May 2009 19:38] Marcos Palacios
Verified fixed in service manager build
[25 Jun 2009 15:22] Tony Bedford
An entry was added to the 2.1.0 changelog:

Any JAVA_OPTS configuration changes made in the catalina.sh file, such as -Xmx, -Xms, were overwritten when the upgrade installer was run. These values were used for customizing larger installations.
[5 Jan 2010 11:52] Simon Mudd
While this ticket is closed I had an issue with this change in that I was not aware of it and on upgrading from 2.0 to 2.1 found that my custom configuration changes required on our site were lost.

Unfortunately the resulting performance problem is not really obvious so I have been struggling for the last few weeks trying to work out why merlin was not performing well since performing the 2.0 to 2.1 upgrade.

I'd like to suggest therefore that in the catalina.sh file you state clearly where the JAVA_OPTS used to be (and at the top of this file) that the file should not be changed as future versions of merlin will overwrite it.

Also the new setenv.sh file should also include some comments showing the default configuration and stating that this is the correct file (and not catalina.sh) for making local changes.

Thanks for making these changes.

Of course please ensure that once the new setenv.sh file exists that it is NOT overwritten....